BigIntOps
static class BigIntOpsimport BigIntOps from Wax;Arithmetic support for the parser's fixed-capacity BigInt scratch values. Operands must fit the 62-limb capacity and have valid normalized active ranges. Operations can mutate shared limb arrays and return updated lengths; assign the result. This surface does not provide checked arbitrary-precision arithmetic.
Inherits from object. Follow these links for inherited members.
Members
kLimbCountconst
const int32 kLimbCount = 62The fixed limb capacity, 62.
kLimbBitsconst
const uint32 kLimbBits = 64uThe bit width of one limb, 64.
Normalizemethod
public static fn Normalize(BigInt bi) : BigIntReturns a record whose active length excludes high zero limbs. Does not copy the shared storage.
Emptymethod
public static fn Empty() : BigIntAllocates an empty zero BigInt.
Makemethod
public static fn Make(uint64 value) : BigIntCreates a normalized BigInt from one unsigned scalar.
Hi64method
public static fn Hi64(BigInt bi) : Hi64ResultReturns the high significant bits left-aligned in 64 bits and reports whether discarded lower bits were nonzero.
Comparemethod
public static fn Compare(BigInt a, BigInt b) : int32Compares normalized values, returning -1, 0, or 1.
ShlBitsmethod
public static fn ShlBits(BigInt bi, uint32 n) : BigIntShifts left by n bits with 0 < n < 64, mutating the limbs. The result must fit capacity.
ShlLimbsmethod
public static fn ShlLimbs(BigInt bi, uint32 n) : BigIntShifts left by n complete limbs, inserting low zero limbs. The result must fit capacity; zero n leaves the value unchanged.
Shlmethod
public static fn Shl(BigInt bi, uint32 n) : BigIntShifts left by any bit count whose result fits capacity, combining whole-limb and partial-limb shifts.
Ctlzmethod
public static fn Ctlz(BigInt bi) : int32Counts leading zeros in the highest active limb. An empty integer returns zero.
BitLengthmethod
public static fn BitLength(BigInt bi) : int32Returns the number of significant bits in a normalized value; zero has length zero.
SmallAddmethod
public static fn SmallAdd(BigInt bi, uint64 y) : BigIntAdds an unsigned scalar to shared limb storage and returns the updated record. The result must fit capacity.
SmallMulmethod
public static fn SmallMul(BigInt bi, uint64 y) : BigIntMultiplies shared limb storage by an unsigned scalar and returns the updated record. The result must fit capacity; Normalize can remove high zero limbs.
LongMulmethod
public static fn LongMul(BigInt x, BigInt y) : BigIntMultiplies x by a nonzero normalized y using long multiplication. Mutates x storage; y must not alias it, and the result must fit capacity.
LargeMulmethod
public static fn LargeMul(BigInt x, BigInt y) : BigIntMultiplies x by a nonzero normalized y, selecting scalar or long multiplication. The arrays must not alias and the result must fit capacity.
Mulmethod
public static fn Mul(BigInt bi, uint64 y) : BigIntMultiplies by a scalar using SmallMul; preserve the returned record and capacity preconditions.
Addmethod
public static fn Add(BigInt bi, uint64 y) : BigIntAdds a scalar using SmallAdd; preserve the returned record and capacity preconditions.
Pow2method
public static fn Pow2(BigInt bi, uint32 exp) : BigIntMultiplies by 2^exp using a left shift. The result must fit capacity.
Pow5method
public static fn Pow5(BigInt bi, uint32 exp) : BigIntMultiplies by 5^exp using parser power tables. The result must fit capacity.
Pow10method
public static fn Pow10(BigInt bi, uint32 exp) : BigIntMultiplies by 10^exp using powers of five and two. The result must fit capacity.