ts-data-forge
    Preparing search index...
    Uint16: {
        add: (x: WithSmallInt, y: WithSmallInt) => Uint16;
        div: (x: WithSmallInt, y: ToNonZeroIntWithSmallInt<Uint16>) => Uint16;
        fromNumber: (x: number) => Uint16;
        is: (a: number) => a is Uint16;
        max: (...values: readonly WithSmallInt<Uint16>[]) => Uint16;
        MAX_VALUE: number;
        min: (...values: readonly WithSmallInt<Uint16>[]) => Uint16;
        MIN_VALUE: 0;
        mul: (x: WithSmallInt, y: WithSmallInt) => Uint16;
        pow: (x: WithSmallInt, y: WithSmallInt) => Uint16;
        random: (min?: WithSmallInt<Uint16>, max?: WithSmallInt<Uint16>) => Uint16;
        sub: (x: WithSmallInt, y: WithSmallInt) => Uint16;
    }

    Namespace providing type-safe operations for the Uint16 branded type.

    The Uint16 type represents a non-negative integer less than 2^16. Division (div) uses floor division.

    Type Declaration

    • add: (x: WithSmallInt, y: WithSmallInt) => Uint16

      Adds two non-negative integers, returning a + b as an Uint16.

    • div: (x: WithSmallInt, y: ToNonZeroIntWithSmallInt<Uint16>) => Uint16

      Divides two non-negative integers using floor division (⌊a / b⌋): the result is a / b rounded toward negative infinity, as an Uint16.

    • fromNumber: (x: number) => Uint16

      Converts an arbitrary number into an Uint16, rounding to the nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].

      Unlike asUint16, this is total: out-of-range inputs are clamped to the nearest representable Uint16 instead of throwing.

    • is: (a: number) => a is Uint16

      Type guard that checks if a value is a non-negative integer less than 2^16.

      isUint16 for usage examples

    • Readonlymax: (...values: readonly WithSmallInt<Uint16>[]) => Uint16

      Returns the largest of the given non-negative integers.

    • MAX_VALUE: number

      The largest value representable as Uint16 (the upper saturation target of fromNumber).

    • Readonlymin: (...values: readonly WithSmallInt<Uint16>[]) => Uint16

      Returns the smallest of the given non-negative integers.

    • MIN_VALUE: 0

      The smallest value representable as Uint16 (the lower saturation target of fromNumber).

    • mul: (x: WithSmallInt, y: WithSmallInt) => Uint16

      Multiplies two non-negative integers, returning a * b as an Uint16.

    • pow: (x: WithSmallInt, y: WithSmallInt) => Uint16

      Raises a to the power b, returning a ** b as an Uint16 (floored to an integer).

    • random: (min?: WithSmallInt<Uint16>, max?: WithSmallInt<Uint16>) => Uint16

      Generates a random Uint16 within the given range.

      The range is inclusive on both ends.

    • sub: (x: WithSmallInt, y: WithSmallInt) => Uint16

      Subtracts two non-negative integers, returning a - b as an Uint16.