Expand description
Unsigned multi-precision integer arithmetic.
Limbs ordered least-significant-limb to most-significant-limb. The bits limbs use the native endianness.
Enums§
Constants§
Functions§
- Processes
limbs
as a sequence of 5-bit windows, folding the windows from most significant to least significant and returning the accumulated result. The first window will be mapped byinit
to produce the initial value for the accumulator. Thenf
will be called to fold the accumulator and the next window until all windows are processed. When the input’s bit length isn’t divisible by 5, the window passed toinit
will be partial; all windows passed tofold
will be full. - Returns the number of bits in
a
. - Equivalent to
if (r >= m) { r -= m; }
- Parses
input
intoresult
, paddingresult
with zeros to its length. This attempts to be constant-time with respect to the value but not with respect to the length; it is assumed that the length is public knowledge. - Parses
input
intoresult
, verifies that the value is less thanmax_exclusive
, and padsresult
with zeros to its length. Ifallow_zero
is notAllowZero::Yes
, zero values are rejected. - Parses
input
intoresult
, reducing it via conditional subtraction (modm
). Assuming 2**((self.num_limbs * LIMB_BITS) - 1) < m and m < 2**(self.num_limbs * LIMB_BITS), the value will be reduced modm
in constant time so that the result is in the range [0, m) ifallow_zero
isAllowZero::Yes
, or [1, m) ifallow_zero
isAllowZero::No
.result
is padded with zeros to its length.