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

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

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

    Type Declaration

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

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

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

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

    • fromNumber: (x: number) => Uint32

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

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

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

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

      isUint32 for usage examples

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

      Returns the largest of the given non-negative integers.

    • MAX_VALUE: number

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

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

      Returns the smallest of the given non-negative integers.

    • MIN_VALUE: 0

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

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

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

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

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

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

      Generates a random Uint32 within the given range.

      The range is inclusive on both ends.

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

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