← Standard library

int16

struct int16

Available without an import.

A 16-bit signed integer with default value zero. Parsing accepts bases 2 through 36 and stops at trailing non-digit text. Use ParseDetailed for a structured error instead of null.

Integers.wax:145

Members

constructorconstructor

public constructor ()

Creates zero.

Integers.wax:150

MinValueconst

const int16 MinValue = -32768

The smallest value representable by this integer type.

Integers.wax:156

MaxValueconst

const int16 MaxValue = 32767

The largest value representable by this integer type.

Integers.wax:160

GetHashCodemethod

public fn GetHashCode() : uint32

Returns a hash consistent with integer value equality.

Integers.wax:164

ToStringmethod

public fn ToString() : string

Returns base-10 text without grouping separators.

Integers.wax:170

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Appends the same text as ToString and returns the number of UTF-8 bytes appended.

Integers.wax:176

Formatmethod

public fn Format(string fmt) : string

Formats decimal by default, hexadecimal for X/x, or binary for B/b. A decimal suffix selects minimum digit width, capped at 99, with zero padding. Signed negative hexadecimal/binary values use this type's two's-complement width; no base prefix is added.

Integers.wax:186

FormatBuffermethod

public fn FormatBuffer(StringBuilder builder, string fmt) : int32

Appends formatted integer text and returns the number of UTF-8 bytes appended.

Integers.wax:192

Equalsmethod

public fn Equals(int16 other) : bool

Tests integer value equality.

Integers.wax:200

CompareTomethod

public fn CompareTo(int16 other) : int32

Returns -1, 0, or 1 for less, equal, or greater.

Integers.wax:204

Parsemethod

public static fn Parse(string text, int32 radix = 10) : int16?

Uses ParseDetailed syntax, returning null instead of throwing on failure. A successful prefix does not imply the entire input was numeric.

Integers.wax:213

ParseDetailedmethod

public static fn ParseDetailed(string text, int32 radix = 10) : int16 throws ParseError

Parses a base-2 through base-36 prefix, skipping leading spaces/tabs and accepting a sign. After the first digit, underscores are ignored and the first invalid digit ends parsing. Throws ParseError for missing/invalid digits, an unsupported radix, or a value outside this type's range.

Integers.wax:224

Reinterpretmethod

public fn Reinterpret<T>() : T where T is numeric

Reinterprets bits as a numeric type of the same width rather than converting the numeric value. Incompatible widths are rejected. Floating-point NaNs are canonicalized when entering or leaving a floating-point type; NaN payload bits are not preserved.

Integers.wax:240