pub struct Uint<const BITS: usize, const LIMBS: usize> {
pub limbs: [u64; LIMBS],
}Fields§
§limbs: [u64; LIMBS]Implementations§
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
pub const ZERO: Self
pub const ONE: Self
pub const MAX: Self
pub const fn from_limbs(limbs: [u64; LIMBS]) -> Self
pub const fn from_u64(v: u64) -> Self
pub fn from_be_slice(bytes: &[u8]) -> Self
pub fn from_le_slice(bytes: &[u8]) -> Self
pub fn to_be_bytes(&self) -> Vec<u8> ⓘ
pub fn to_le_bytes(&self) -> Vec<u8> ⓘ
pub fn to_be_bytes_fixed<const N: usize>(&self) -> [u8; N]
pub fn to_le_bytes_fixed<const N: usize>(&self) -> [u8; N]
pub fn bit(&self, index: usize) -> bool
pub fn is_zero(&self) -> bool
pub fn is_odd(&self) -> bool
pub fn ct_ge(&self, rhs: &Self) -> bool
pub fn ct_eq(&self, rhs: &Self) -> bool
pub fn ct_select(a: &Self, b: &Self, choice: bool) -> Self
pub fn add_raw(&self, rhs: &Self) -> (Self, u64)
pub fn sub_raw(&self, rhs: &Self) -> (Self, u64)
pub fn add_mod(&self, rhs: &Self, modulus: &Self) -> Self
pub fn sub_mod(&self, rhs: &Self, modulus: &Self) -> Self
pub fn double_mod(&self, modulus: &Self) -> Self
pub fn mul_mod(&self, rhs: &Self, modulus: &Self) -> Self
Sourcepub fn reduce_wide_barrett<const MU_LIMBS: usize>(
product: &[u64; 64],
modulus: &Self,
mu: &[u64; MU_LIMBS],
) -> Self
pub fn reduce_wide_barrett<const MU_LIMBS: usize>( product: &[u64; 64], modulus: &Self, mu: &[u64; MU_LIMBS], ) -> Self
Barrett reduction of a 2*LIMBS-wide product modulo modulus.
mu must equal floor(2^(2*LIMBS*64) / modulus) and have LIMBS+1 limbs.
Sourcepub fn mul_mod_barrett<const MU_LIMBS: usize>(
&self,
rhs: &Self,
modulus: &Self,
mu: &[u64; MU_LIMBS],
) -> Self
pub fn mul_mod_barrett<const MU_LIMBS: usize>( &self, rhs: &Self, modulus: &Self, mu: &[u64; MU_LIMBS], ) -> Self
Modular multiplication using Barrett reduction.
mu must equal floor(2^(2*LIMBS*64) / modulus) and have LIMBS+1 limbs.
pub fn add_word(&self, word: u64) -> (Self, u64)
pub fn sub_word(&self, word: u64) -> (Self, u64)
pub fn mul_word(&self, word: u64) -> (Self, u64)
pub fn div_rem_word(&self, word: u64) -> (Self, u64)
pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, Error>
pub fn to_string_radix(&self, radix: u32) -> String
Trait Implementations§
impl<const BITS: usize, const LIMBS: usize> Copy for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> Display for Uint<BITS, LIMBS>
Available on crate feature alloc only.
impl<const BITS: usize, const LIMBS: usize> Display for Uint<BITS, LIMBS>
Available on crate feature
alloc only.impl<const BITS: usize, const LIMBS: usize> Eq for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialEq for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialEq for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> StructuralPartialEq for Uint<BITS, LIMBS>
Auto Trait Implementations§
impl<const BITS: usize, const LIMBS: usize> Freeze for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> RefUnwindSafe for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Send for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Sync for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Unpin for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> UnsafeUnpin for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> UnwindSafe for Uint<BITS, LIMBS>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more