pub struct HeaplessBigInt<T, const CAP: usize, P: Personality = Nct>where
T: MachineWord,{ /* private fields */ }Expand description
A len-word unsigned integer whose width is chosen at runtime.
Behaves bit-for-bit like FixedUInt<T, len>: every op
resolves at the value’s width (len·word_bits), never a growable bignum.
CAP is the maximum limb count (compile-time storage ceiling); len is the
logical used-limb count (runtime) and the operating width — the words in
[len, CAP) do not exist for arithmetic. Invariants (enforced by the
module):
CAP <= u16::MAX as usize(compile-time-asserted).(len as usize) <= CAP.limbs[len as usize..CAP]is all zero at every observable state.lenis set only from public shape parameters, never from limb content.
Implementations§
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn wrapping_add(&self, other: &Self) -> Self
pub fn wrapping_add(&self, other: &Self) -> Self
Wrapping addition at the operands’ width max(a.len, b.len); a
carry out of that width is discarded.
Sourcepub fn overflowing_add(&self, other: &Self) -> (Self, bool)
pub fn overflowing_add(&self, other: &Self) -> (Self, bool)
Overflowing addition, at the operands’ width max(a.len, b.len).
Returns (sum mod 2^(width·word_bits), carry_out) — the carry is
the bit beyond the width, reported as a flag, exactly as
FixedUInt<T, width>::overflowing_add does. Symmetric to
overflowing_sub. Does not grow a limb.
Sourcepub fn checked_add(&self, other: &Self) -> Option<Self>
pub fn checked_add(&self, other: &Self) -> Option<Self>
Checked addition. None on overflow at the operands’ width.
Sourcepub fn wrapping_sub(&self, other: &Self) -> Self
pub fn wrapping_sub(&self, other: &Self) -> Self
Wrapping subtraction at the operands’ width max(a.len, b.len);
underflow wraps modulo 2^(max_len·WORD_BITS), so a value carried
at a narrower width wraps at that narrower width (like u8 vs u32).
Sourcepub fn overflowing_sub(&self, other: &Self) -> (Self, bool)
pub fn overflowing_sub(&self, other: &Self) -> (Self, bool)
Overflowing subtraction. Returns (wrapped_result, borrow_out).
Same width choice as wrapping_sub;
borrow_out is the underflow flag (self < other).
Sourcepub fn checked_sub(&self, other: &Self) -> Option<Self>
pub fn checked_sub(&self, other: &Self) -> Option<Self>
Checked subtraction. None on underflow.
Source§impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn wrapping_mul(&self, other: &Self) -> Self
pub fn wrapping_mul(&self, other: &Self) -> Self
Wrapping multiplication at the operands’ width max(a.len, b.len):
keeps the low width words (a·b mod 2^(width·word_bits)),
exactly like FixedUInt<T, width>::wrapping_mul. [WideMul] returns
both halves.
Sourcepub fn overflowing_mul(&self, other: &Self) -> (Self, bool)
pub fn overflowing_mul(&self, other: &Self) -> (Self, bool)
Overflowing multiplication, at the operands’ width
w = max(a.len, b.len). Returns (a·b mod 2^(w·word_bits), overflow), where overflow is set iff the product does not fit
in w words — bit-identical to FixedUInt<T, w>::overflowing_mul.
The split is at the value width (via the widening CarryingMul), so
the high half is the part beyond w; CAP is irrelevant.
Sourcepub fn checked_mul(&self, other: &Self) -> Option<Self>
pub fn checked_mul(&self, other: &Self) -> Option<Self>
Checked multiplication. None when the product does not fit in the
operands’ width max(a.len, b.len) — exactly when
FixedUInt<T, width>::checked_mul would return None.
Source§impl<T: MachineWord, const CAP: usize> HeaplessBigInt<T, CAP, Nct>
impl<T: MachineWord, const CAP: usize> HeaplessBigInt<T, CAP, Nct>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn bit_length(&self) -> usize
pub fn bit_length(&self) -> usize
Number of bits needed to represent the value: 0 for zero,
otherwise the position of the highest set bit plus one.
Sourcepub fn leading_zeros(&self) -> usize
pub fn leading_zeros(&self) -> usize
Leading zeros against the value’s width (len * word_bits), so
leading_zeros + bit_length == bits_precision(). A len = 0
value has width 0, hence leading_zeros() == 0.
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn to_be_bytes<'a>(&self, out: &'a mut [u8]) -> &'a [u8]
pub fn to_be_bytes<'a>(&self, out: &'a mut [u8]) -> &'a [u8]
Serialize into out as big-endian bytes. Writes self.len * size_of::<T>() bytes into out[..byte_count] and returns that
slice. Panics if out.len() < byte_count.
Sourcepub fn to_le_bytes<'a>(&self, out: &'a mut [u8]) -> &'a [u8]
pub fn to_le_bytes<'a>(&self, out: &'a mut [u8]) -> &'a [u8]
Serialize into out as little-endian bytes. Same size + panic
contract as to_be_bytes.
Sourcepub fn from_be_bytes(bytes: &[u8]) -> Self
pub fn from_be_bytes(bytes: &[u8]) -> Self
Deserialize a big-endian byte slice. Output len = ceil(bytes.len() / word_size), capped at CAP. A partial top
word (input length not a multiple of word_size) leaves the
missing high bytes zero — matches the BE convention. Panics if
bytes.len() > CAP * word_size.
Sourcepub fn from_le_bytes(bytes: &[u8]) -> Self
pub fn from_le_bytes(bytes: &[u8]) -> Self
Deserialize a little-endian byte slice. Same size contract as
from_be_bytes.
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn new_zero_with_len(len: u16) -> Self
pub fn new_zero_with_len(len: u16) -> Self
Zero with a caller-supplied logical length. The len is treated as
a public shape parameter from here on. Panics if len > CAP.
Sourcepub fn zero_full_cap() -> Self
pub fn zero_full_cap() -> Self
Full-capacity zero: len = CAP. Used where an algorithm needs a
pre-sized workspace (CIOS accumulator, product buffer).
Sourcepub fn from_limbs(limbs: [T; CAP], len: u16) -> Self
pub fn from_limbs(limbs: [T; CAP], len: u16) -> Self
Construct from a limb array + explicit len. Panics if len > CAP
or if any limb at index >= len is non-zero (invariant check).
The tail check runs in every build, not just under debug_assertions:
downstream arithmetic, equality, and widened all assume the tail is
zero, so a release build that skipped it would silently promote a
hidden limb into the value.
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HeaplessBigInt<T, CAP, P>
Sourcepub fn widened(&self, new_len: u16) -> Self
pub fn widened(&self, new_len: u16) -> Self
Return a copy carried at new_len words, pinning the operating
width without changing the value.
Arithmetic here is width-driven: a HeaplessBigInt at len = k
behaves exactly like FixedUInt<T, k>, and every op resolves at
max(operand len). So a value assembled from small pieces (e.g. an
accumulator seeded from zero then
added to a one-word digit) is a narrow type and wraps at that
narrow width. To carry it at a chosen width — the way you pick N
for FixedUInt — pin it here once; subsequent ops keep that width
because max preserves it. Widening only relabels the width: the
limbs in [len, new_len) are already zero by the zero-tail
invariant.
Panics if new_len < len (this only widens) or new_len > CAP.
Trait Implementations§
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Add for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Add for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Add<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Add<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
+ operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> Add<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Add<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Add<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Add<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
+ operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
& operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitAnd<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
& operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitOr for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitOr for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
| operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitOr<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
| operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitWidth for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitWidth for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitWidth for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitWidth for &HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> BitsPrecision for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitsPrecision for HeaplessBigInt<T, CAP, P>
Source§fn bits_precision(&self) -> u32
fn bits_precision(&self) -> u32
self operates over (its constructed width). Read moreSource§impl<T: MachineWord, const CAP: usize, P: Personality> BitsPrecision for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> BitsPrecision for &HeaplessBigInt<T, CAP, P>
Source§fn bits_precision(&self) -> u32
fn bits_precision(&self) -> u32
self operates over (its constructed width). Read moreSource§impl<T, const CAP: usize, P: Personality> BorrowingSub for HeaplessBigInt<T, CAP, P>where
T: MachineWord,
impl<T, const CAP: usize, P: Personality> BorrowingSub for HeaplessBigInt<T, CAP, P>where
T: MachineWord,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§impl<T, const CAP: usize, P: Personality> CarryingAdd for HeaplessBigInt<T, CAP, P>where
T: MachineWord,
impl<T, const CAP: usize, P: Personality> CarryingAdd for HeaplessBigInt<T, CAP, P>where
T: MachineWord,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§impl<T, const CAP: usize, P: Personality> CarryingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize, P: Personality> CarryingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Unsigned = HeaplessBigInt<T, CAP, P>
type Unsigned = HeaplessBigInt<T, CAP, P>
Self for unsigned types,
the unsigned counterpart for signed types (matching std’s
carrying_mul signatures).Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§impl<T, const CAP: usize> CheckedAdd for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord,
impl<T, const CAP: usize> CheckedAdd for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord,
Source§type Output = HeaplessBigInt<T, CAP>
type Output = HeaplessBigInt<T, CAP>
Self for the primitive impls; a distinct owned type
lets non-Copy types implement this via impl for &Self.Source§fn checked_add(self, v: Self) -> Option<Self>
fn checked_add(self, v: Self) -> Option<Self>
None is
returned.Source§impl<T, const CAP: usize> CheckedMul for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> CheckedMul for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Output = HeaplessBigInt<T, CAP>
type Output = HeaplessBigInt<T, CAP>
Self for the primitive impls).Source§fn checked_mul(self, v: Self) -> Option<Self>
fn checked_mul(self, v: Self) -> Option<Self>
None is returned.Source§impl<T: MachineWord, const CAP: usize, P: Personality> Clone for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Clone for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize, P: Personality> ConditionallySelectable for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConditionallySelectable,
impl<T, const CAP: usize, P: Personality> ConditionallySelectable for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConditionallySelectable,
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self and other if choice == 1; otherwise,
reassign both unto themselves. Read moreSource§impl<T: MachineWord, const CAP: usize, P: Personality> ConstOne for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> ConstOne for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> ConstZero for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> ConstZero for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize, P: Personality> ConstantTimeEq for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConstantTimeEq,
impl<T, const CAP: usize, P: Personality> ConstantTimeEq for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConstantTimeEq,
Source§impl<T, const CAP: usize, P: Personality> ConstantTimeGreater for HeaplessBigInt<T, CAP, P>
impl<T, const CAP: usize, P: Personality> ConstantTimeGreater for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize, P: Personality> ConstantTimeLess for HeaplessBigInt<T, CAP, P>
impl<T, const CAP: usize, P: Personality> ConstantTimeLess for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Copy for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize, P: Personality> CtIsZero for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConstantTimeEq,
impl<T, const CAP: usize, P: Personality> CtIsZero for HeaplessBigInt<T, CAP, P>where
T: MachineWord + ConstantTimeEq,
Source§fn ct_is_zero(&self) -> Choice
fn ct_is_zero(&self) -> Choice
Source§impl<T: MachineWord + Debug, const CAP: usize> Debug for HeaplessBigInt<T, CAP, Nct>
impl<T: MachineWord + Debug, const CAP: usize> Debug for HeaplessBigInt<T, CAP, Nct>
Source§impl<T: MachineWord, const CAP: usize> Debug for HeaplessBigInt<T, CAP, Ct>
impl<T: MachineWord, const CAP: usize> Debug for HeaplessBigInt<T, CAP, Ct>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Default for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Default for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize> Div for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Div for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Div<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Div<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Div<&HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Div<&HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Div<HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Div<HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> DivAssign for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> DivAssign for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreSource§impl<T, const CAP: usize> DivAssign<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> DivAssign<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§fn div_assign(&mut self, other: &Self)
fn div_assign(&mut self, other: &Self)
/= operation. Read moreimpl<T: MachineWord, const CAP: usize, P: Personality> Eq for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> From<u8> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> From<u8> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> From<u16> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> From<u16> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> From<u32> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> From<u32> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> FromByteSlice for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> FromByteSlice for HeaplessBigInt<T, CAP, P>
Source§fn from_be_slice(bytes: &[u8]) -> Result<Self, ByteSliceError>
fn from_be_slice(bytes: &[u8]) -> Result<Self, ByteSliceError>
Source§fn from_le_slice(bytes: &[u8]) -> Result<Self, ByteSliceError>
fn from_le_slice(bytes: &[u8]) -> Result<Self, ByteSliceError>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> HasPersonality for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> HasPersonality for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord + Hash, const CAP: usize, P: Personality> Hash for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + Hash, const CAP: usize, P: Personality> Hash for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
* operator.Source§impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord + CarryingMul<Unsigned = T, Output = T>, const CAP: usize, P: Personality> Mul<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
* operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> One for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> One for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Ord for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Ord for HeaplessBigInt<T, CAP, P>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingAdd for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingAdd for HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_add(self, v: Self) -> (Self::Output, bool)
fn overflowing_add(self, v: Self) -> (Self::Output, bool)
Source§impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingAdd for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingAdd for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_add(self, v: Self) -> (Self::Output, bool)
fn overflowing_add(self, v: Self) -> (Self::Output, bool)
Source§impl<T, const CAP: usize, P: Personality> OverflowingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize, P: Personality> OverflowingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_mul(self, v: Self) -> (Self::Output, bool)
fn overflowing_mul(self, v: Self) -> (Self::Output, bool)
Source§impl<T, const CAP: usize, P: Personality> OverflowingMul for &HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize, P: Personality> OverflowingMul for &HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_mul(self, v: Self) -> (Self::Output, bool)
fn overflowing_mul(self, v: Self) -> (Self::Output, bool)
Source§impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingSub for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingSub for HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_sub(self, v: Self) -> (Self::Output, bool)
fn overflowing_sub(self, v: Self) -> (Self::Output, bool)
Source§impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingSub for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> OverflowingSub for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn overflowing_sub(self, v: Self) -> (Self::Output, bool)
fn overflowing_sub(self, v: Self) -> (Self::Output, bool)
Source§impl<T, const CAP: usize, P: Personality> Parity for HeaplessBigInt<T, CAP, P>where
T: MachineWord + Parity,
impl<T, const CAP: usize, P: Personality> Parity for HeaplessBigInt<T, CAP, P>where
T: MachineWord + Parity,
Source§impl<T: MachineWord, const CAP: usize, P: Personality> PartialEq for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> PartialEq for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> PartialOrd for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> PartialOrd for HeaplessBigInt<T, CAP, P>
Source§impl<T, const CAP: usize> Rem for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Rem for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Rem<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Rem<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Rem<&HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Rem<&HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> Rem<HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> Rem<HeaplessBigInt<T, CAP>> for &HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§impl<T, const CAP: usize> RemAssign for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> RemAssign for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§fn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
%= operation. Read moreSource§impl<T, const CAP: usize> RemAssign<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize> RemAssign<&HeaplessBigInt<T, CAP>> for HeaplessBigInt<T, CAP, Nct>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§fn rem_assign(&mut self, other: &Self)
fn rem_assign(&mut self, other: &Self)
%= operation. Read moreSource§impl<T: MachineWord, const CAP: usize, P: Personality> Shl<usize> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Shl<usize> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> ShlAssign<usize> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> ShlAssign<usize> for HeaplessBigInt<T, CAP, P>
Source§fn shl_assign(&mut self, bits: usize)
fn shl_assign(&mut self, bits: usize)
<<= operation. Read moreSource§impl<T: MachineWord, const CAP: usize, P: Personality> Shr<usize> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Shr<usize> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> ShrAssign<usize> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> ShrAssign<usize> for HeaplessBigInt<T, CAP, P>
Source§fn shr_assign(&mut self, bits: usize)
fn shr_assign(&mut self, bits: usize)
>>= operation. Read moreSource§impl<T: MachineWord, const CAP: usize, P: Personality> Sub for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Sub for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Sub<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Sub<&HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
- operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> Sub<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Sub<&HeaplessBigInt<T, CAP, P>> for HeaplessBigInt<T, CAP, P>
Source§impl<T: MachineWord, const CAP: usize, P: Personality> Sub<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> Sub<HeaplessBigInt<T, CAP, P>> for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
- operator.Source§impl<T: MachineWord, const CAP: usize, P: Personality> WithPrecision for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> WithPrecision for HeaplessBigInt<T, CAP, P>
Source§fn widen_to_precision(self, bits_precision: u32) -> Self
fn widen_to_precision(self, bits_precision: u32) -> Self
self re-represented over a width of at least
bits_precision, preserving its numeric value. Never shrinks; on a
fixed-width carrier the width is the type and this is the identity.Source§fn zero_with_precision(bits_precision: u32) -> Selfwhere
Self: Zero,
fn zero_with_precision(bits_precision: u32) -> Selfwhere
Self: Zero,
Zero carried at a width of at least bits_precision.Source§fn one_with_precision(bits_precision: u32) -> Selfwhere
Self: One,
fn one_with_precision(bits_precision: u32) -> Selfwhere
Self: One,
One carried at a width of at least bits_precision.Source§fn widen_to_precision_of(self, witness: &Self) -> Self
fn widen_to_precision_of(self, witness: &Self) -> Self
widen_to_precision to the width of a
witness value — typically the modulus a reducer operates over. Prefer
this to hand-picking a bit count: the witness carries the intended width.Source§fn zero_with_precision_of(witness: &Self) -> Selfwhere
Self: Zero,
fn zero_with_precision_of(witness: &Self) -> Selfwhere
Self: Zero,
Zero carried at the witness’s width — the width-safe
seed for a generic accumulator.Source§fn one_with_precision_of(witness: &Self) -> Selfwhere
Self: One,
fn one_with_precision_of(witness: &Self) -> Selfwhere
Self: One,
One carried at the witness’s width.Source§impl<T: MachineWord, const CAP: usize, P: Personality> WrappingAdd for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> WrappingAdd for HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_add(self, v: Self) -> Self::Output
fn wrapping_add(self, v: Self) -> Self::Output
self + other, wrapping around at the boundary of
the type.Source§impl<T: MachineWord, const CAP: usize, P: Personality> WrappingAdd for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> WrappingAdd for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_add(self, v: Self) -> Self::Output
fn wrapping_add(self, v: Self) -> Self::Output
self + other, wrapping around at the boundary of
the type.Source§impl<T, const CAP: usize, P: Personality> WrappingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize, P: Personality> WrappingMul for HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_mul(self, v: Self) -> Self::Output
fn wrapping_mul(self, v: Self) -> Self::Output
self * other, wrapping around at the boundary
of the type.Source§impl<T, const CAP: usize, P: Personality> WrappingMul for &HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
impl<T, const CAP: usize, P: Personality> WrappingMul for &HeaplessBigInt<T, CAP, P>where
T: MachineWord + CarryingMul<Unsigned = T, Output = T>,
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_mul(self, v: Self) -> Self::Output
fn wrapping_mul(self, v: Self) -> Self::Output
self * other, wrapping around at the boundary
of the type.Source§impl<T: MachineWord, const CAP: usize, P: Personality> WrappingSub for HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> WrappingSub for HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_sub(self, v: Self) -> Self::Output
fn wrapping_sub(self, v: Self) -> Self::Output
self - other, wrapping around at the boundary
of the type.Source§impl<T: MachineWord, const CAP: usize, P: Personality> WrappingSub for &HeaplessBigInt<T, CAP, P>
impl<T: MachineWord, const CAP: usize, P: Personality> WrappingSub for &HeaplessBigInt<T, CAP, P>
Source§type Output = HeaplessBigInt<T, CAP, P>
type Output = HeaplessBigInt<T, CAP, P>
Self for the primitive impls).Source§fn wrapping_sub(self, v: Self) -> Self::Output
fn wrapping_sub(self, v: Self) -> Self::Output
self - other, wrapping around at the boundary
of the type.