Adds two non-negative safe integers, returning a + b as a SafeUint.
Divides two non-negative safe integers using floor division (⌊a / b⌋):
the result is a / b rounded toward negative infinity, as a SafeUint.
Converts an arbitrary number into a SafeUint, rounding to the nearest
integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].
Unlike asSafeUint, this is total: out-of-range inputs are clamped to the
nearest representable SafeUint instead of throwing.
Type guard that checks if a value is a non-negative safe integer.
isSafeUint for usage examples
Readonlymax: (...values: readonly WithSmallInt<SafeUint>[]) => SafeUintReturns the largest of the given non-negative safe integers.
The largest value representable as SafeUint (the upper saturation target
of fromNumber).
Readonlymin: (...values: readonly WithSmallInt<SafeUint>[]) => SafeUintReturns the smallest of the given non-negative safe integers.
The smallest value representable as SafeUint (the lower saturation target
of fromNumber).
Multiplies two non-negative safe integers, returning a * b as a
SafeUint.
Raises a to the power b, returning a ** b as a SafeUint (floored to
an integer).
Generates a random SafeUint within the given range.
The range is inclusive on both ends.
Subtracts two non-negative safe integers, returning a - b as a
SafeUint.
Namespace providing type-safe operations for the
SafeUintbranded type.The
SafeUinttype represents a non-negative safe integer. Division (div) uses floor division.