Struct crypto_bigint::UInt

source ·
pub struct UInt<const LIMBS: usize> { /* private fields */ }
Expand description

Big unsigned integer.

Generic over the given number of LIMBS

Encoding support

This type supports many different types of encodings, either via the Encoding trait or various const fn decoding and encoding functions that can be used with UInt constants.

Optional crate features for encoding (off-by-default):

Implementations§

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn adc(&self, rhs: &Self, carry: Limb) -> (Self, Limb)

Computes a + b + carry, returning the result along with the new carry.

source

pub const fn saturating_add(&self, rhs: &Self) -> Self

Perform saturating addition, returning MAX on overflow.

source

pub const fn wrapping_add(&self, rhs: &Self) -> Self

Perform wrapping addition, discarding overflow.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn add_mod(&self, rhs: &UInt<LIMBS>, p: &UInt<LIMBS>) -> UInt<LIMBS>

Computes self + rhs mod p in constant time.

Assumes self and rhs are < p.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn bitand(&self, rhs: &Self) -> Self

Computes bitwise a & b.

source

pub const fn wrapping_and(&self, rhs: &Self) -> Self

Perform wrapping bitwise AND.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_and(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise AND, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn not(&self) -> Self

Computes bitwise !a.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn bitor(&self, rhs: &Self) -> Self

Computes bitwise a & b.

source

pub const fn wrapping_or(&self, rhs: &Self) -> Self

Perform wrapping bitwise OR.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_or(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise OR, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn bitxor(&self, rhs: &Self) -> Self

Computes bitwise a ^ b.

source

pub const fn wrapping_xor(&self, rhs: &Self) -> Self

Perform wrapping bitwise `XOR``.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_xor(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise XOR, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn bits(self) -> usize

Calculate the number of bits needed to represent this number.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub fn div_rem(&self, rhs: &Self) -> CtOption<(Self, Self)>

Computes self / rhs, returns the quotient, remainder if rhs != 0

source

pub fn reduce(&self, rhs: &Self) -> CtOption<Self>

Computes self % rhs, returns the remainder if rhs != 0

source

pub const fn wrapping_div(&self, rhs: &Self) -> Self

Wrapped division is just normal division i.e. self / rhs There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

source

pub fn checked_div(&self, rhs: &Self) -> CtOption<Self>

Perform checked division, returning a CtOption which is_some only if the rhs != 0

source

pub const fn wrapping_rem(&self, rhs: &Self) -> Self

Wrapped (modular) remainder calculation is just self % rhs. There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

source

pub fn checked_rem(&self, rhs: &Self) -> CtOption<Self>

Perform checked reduction, returning a CtOption which is_some only if the rhs != 0

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn from_be_slice(bytes: &[u8]) -> Self

Create a new UInt from the provided big endian bytes.

source

pub const fn from_be_hex(hex: &str) -> Self

Create a new UInt from the provided big endian hex string.

source

pub const fn from_le_slice(bytes: &[u8]) -> Self

Create a new UInt from the provided little endian bytes.

source

pub const fn from_le_hex(hex: &str) -> Self

Create a new UInt from the provided little endian hex string.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn from_u8(n: u8) -> Self

Create a UInt from a u8 (const-friendly)

source

pub const fn from_u16(n: u16) -> Self

Create a UInt from a u16 (const-friendly)

source

pub const fn from_u32(n: u32) -> Self

Create a UInt from a u32 (const-friendly)

source

pub const fn from_u64(n: u64) -> Self

Create a UInt from a u64 (const-friendly)

source

pub const fn from_u128(n: u128) -> Self

Create a UInt from a u128 (const-friendly)

source

pub const fn from_uint_array(arr: [LimbUInt; LIMBS]) -> Self

Create a UInt from an array of the LimbUInt unsigned integer type.

source

pub const fn to_uint_array(self) -> [LimbUInt; LIMBS]

Create an array of LimbUInt unsigned integers from a UInt.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn mul_wide(&self, rhs: &Self) -> (Self, Self)

Compute “wide” multiplication, with a product twice the size of the input.

Returns a tuple containing the (lo, hi) components of the product.

Ordering note

Releases of crypto-bigint prior to v0.3 used (hi, lo) ordering instead. This has been changed for better consistency with the rest of the APIs in this crate.

For more info see: https://github.com/RustCrypto/crypto-bigint/issues/4

source

pub const fn saturating_mul(&self, rhs: &Self) -> Self

Perform saturating multiplication, returning MAX on overflow.

source

pub const fn wrapping_mul(&self, rhs: &Self) -> Self

Perform wrapping multiplication, discarding overflow.

source

pub fn square(&self) -> <Self as Concat>::Output
where Self: Concat,

Square self, returning a “wide” result.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn neg_mod(&self, p: &Self) -> Self

Computes -a mod p in constant time.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn shl_vartime(&self, n: usize) -> Self

Computes self << shift.

NOTE: this operation is variable time with respect to n ONLY.

When used with a fixed n, this function is constant-time with respect to self.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn shr_vartime(&self, shift: usize) -> Self

Computes self >> n.

NOTE: this operation is variable time with respect to n ONLY.

When used with a fixed n, this function is constant-time with respect to self.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn sqrt(&self) -> Self

Computes √(self) Uses Brent & Zimmermann, Modern Computer Arithmetic, v0.5.9, Algorithm 1.13

Callers can check if self is a square by squaring the result

source

pub const fn wrapping_sqrt(&self) -> Self

Wrapped sqrt is just normal √(self) There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

source

pub fn checked_sqrt(&self) -> CtOption<Self>

Perform checked sqrt, returning a CtOption which is_some only if the √(self)² == self

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn sbb(&self, rhs: &Self, borrow: Limb) -> (Self, Limb)

Computes a - (b + borrow), returning the result along with the new borrow.

source

pub const fn saturating_sub(&self, rhs: &Self) -> Self

Perform saturating subtraction, returning ZERO on underflow.

source

pub const fn wrapping_sub(&self, rhs: &Self) -> Self

Perform wrapping subtraction, discarding underflow and wrapping around the boundary of the type.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const fn sub_mod(&self, rhs: &UInt<LIMBS>, p: &UInt<LIMBS>) -> UInt<LIMBS>

Computes self - rhs mod p in constant time.

Assumes self and rhs are < p.

source§

impl<const LIMBS: usize> UInt<LIMBS>

source

pub const ZERO: Self = _

The value 0.

source

pub const ONE: Self = _

The value 1.

source

pub const MAX: Self = _

Maximum value this UInt can express.

source

pub const fn new(limbs: [Limb; LIMBS]) -> Self

Const-friendly UInt constructor.

source

pub const fn limbs(&self) -> &[Limb; LIMBS]

Borrow the limbs of this UInt.

source

pub const fn into_limbs(self) -> [Limb; LIMBS]

Convert this UInt into its inner limbs.

Trait Implementations§

source§

impl AddMod for UInt<1>

§

type Output = UInt<1>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<10>

§

type Output = UInt<10>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<11>

§

type Output = UInt<11>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<12>

§

type Output = UInt<12>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<2>

§

type Output = UInt<2>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<3>

§

type Output = UInt<3>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<4>

§

type Output = UInt<4>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<5>

§

type Output = UInt<5>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<6>

§

type Output = UInt<6>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<7>

§

type Output = UInt<7>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<8>

§

type Output = UInt<8>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AddMod for UInt<9>

§

type Output = UInt<9>

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl<const LIMBS: usize> AsMut<[Limb]> for UInt<LIMBS>

source§

fn as_mut(&mut self) -> &mut [Limb]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<const LIMBS: usize> AsRef<[Limb]> for UInt<LIMBS>

source§

fn as_ref(&self) -> &[Limb]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<const LIMBS: usize> BitAnd<&UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd<UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: UInt<LIMBS>) -> UInt<LIMBS>

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> UInt<LIMBS>

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAndAssign<&UInt<LIMBS>> for UInt<LIMBS>

source§

fn bitand_assign(&mut self, other: &Self)

Performs the &= operation. Read more
source§

impl<const LIMBS: usize> BitAndAssign for UInt<LIMBS>

source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
source§

impl<const LIMBS: usize> BitOr<&UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr<UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: UInt<LIMBS>) -> UInt<LIMBS>

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> UInt<LIMBS>

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOrAssign<&UInt<LIMBS>> for UInt<LIMBS>

source§

fn bitor_assign(&mut self, other: &Self)

Performs the |= operation. Read more
source§

impl<const LIMBS: usize> BitOrAssign for UInt<LIMBS>

source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
source§

impl<const LIMBS: usize> BitXor<&UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &UInt<LIMBS>) -> UInt<LIMBS>

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor<UInt<LIMBS>> for &UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: UInt<LIMBS>) -> UInt<LIMBS>

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> UInt<LIMBS>

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXorAssign<&UInt<LIMBS>> for UInt<LIMBS>

source§

fn bitxor_assign(&mut self, other: &Self)

Performs the ^= operation. Read more
source§

impl<const LIMBS: usize> BitXorAssign for UInt<LIMBS>

source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
source§

impl<const LIMBS: usize> CheckedAdd<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

Output type.
source§

fn checked_add(&self, rhs: &Self) -> CtOption<Self>

Perform checked subtraction, returning a CtOption which is_some only if the operation did not overflow.
source§

impl<const LIMBS: usize> CheckedMul<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

Output type.
source§

fn checked_mul(&self, rhs: &Self) -> CtOption<Self>

Perform checked multiplication, returning a CtOption which is_some only if the operation did not overflow.
source§

impl<const LIMBS: usize> CheckedSub<&UInt<LIMBS>> for UInt<LIMBS>

§

type Output = UInt<LIMBS>

Output type.
source§

fn checked_sub(&self, rhs: &Self) -> CtOption<Self>

Perform checked subtraction, returning a CtOption which is_some only if the operation did not underflow.
source§

impl<const LIMBS: usize> Clone for UInt<LIMBS>

source§

fn clone(&self) -> UInt<LIMBS>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const LIMBS: usize> ConditionallySelectable for UInt<LIMBS>

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl<const LIMBS: usize> ConstantTimeEq for UInt<LIMBS>

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

impl<const LIMBS: usize> ConstantTimeGreater for UInt<LIMBS>

source§

fn ct_gt(&self, other: &Self) -> Choice

Determine whether self > other. Read more
source§

impl<const LIMBS: usize> ConstantTimeLess for UInt<LIMBS>

source§

fn ct_lt(&self, other: &Self) -> Choice

Determine whether self < other. Read more
source§

impl<const LIMBS: usize> Debug for UInt<LIMBS>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const LIMBS: usize> Default for UInt<LIMBS>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const LIMBS: usize> Display for UInt<LIMBS>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const LIMBS: usize> Div<&NonZero<UInt<LIMBS>>> for &UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &NonZero<UInt<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<&NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &NonZero<UInt<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<UInt<LIMBS>>> for &UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<UInt<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<UInt<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> DivAssign<&NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

source§

fn div_assign(&mut self, rhs: &NonZero<UInt<LIMBS>>)

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> DivAssign<NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

source§

fn div_assign(&mut self, rhs: NonZero<UInt<LIMBS>>)

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> From<[Limb; LIMBS]> for UInt<LIMBS>

source§

fn from(limbs: [Limb; LIMBS]) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<[u64; LIMBS]> for UInt<LIMBS>

source§

fn from(arr: [LimbUInt; LIMBS]) -> Self

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U512, U512)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U64, U64)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U192, U192)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U896, U896)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U256, U256)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U128, U128)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U1536, U1536)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U3072, U3072)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U448, U448)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U1792, U1792)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U2048, U2048)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U1024, U1024)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U384, U384)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U768, U768)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl From<(UInt<{nlimbs!($bits)}>, UInt<{nlimbs!($bits)}>)> for UInt<{ _ }>

source§

fn from(nums: (U4096, U4096)) -> UInt<{ _ }>

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<Limb> for UInt<LIMBS>

source§

fn from(limb: Limb) -> Self

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U8192) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U192) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U384) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U128) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U256) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U2048) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U768) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U1536) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U448) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U1024) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U3072) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U6144) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U4096) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U1792) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U3584) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U512) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for (UInt<{ _ }>, UInt<{ _ }>)

source§

fn from(num: U896) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for u128

source§

fn from(n: U128) -> u128

Converts to this type from the input type.
source§

impl From<UInt<{nlimbs!($bits)}>> for u64

source§

fn from(n: U64) -> u64

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<UInt<LIMBS>> for [Limb; LIMBS]

source§

fn from(n: UInt<LIMBS>) -> [Limb; LIMBS]

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<UInt<LIMBS>> for [LimbUInt; LIMBS]

source§

fn from(n: UInt<LIMBS>) -> [LimbUInt; LIMBS]

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<u128> for UInt<LIMBS>

source§

fn from(n: u128) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<u16> for UInt<LIMBS>

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<u32> for UInt<LIMBS>

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<u64> for UInt<LIMBS>

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<u8> for UInt<LIMBS>

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> Hash for UInt<LIMBS>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<const LIMBS: usize> Integer for UInt<LIMBS>

source§

const ONE: Self = Self::ONE

The value 1.
source§

const MAX: Self = Self::MAX

Maximum value this integer can express.
source§

fn is_odd(&self) -> Choice

Is this integer value an odd number? Read more
source§

fn is_even(&self) -> Choice

Is this integer value an even number? Read more
source§

impl<const LIMBS: usize> LowerHex for UInt<LIMBS>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl NegMod for UInt<1>

§

type Output = UInt<1>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<10>

§

type Output = UInt<10>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<11>

§

type Output = UInt<11>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<12>

§

type Output = UInt<12>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<2>

§

type Output = UInt<2>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<3>

§

type Output = UInt<3>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<4>

§

type Output = UInt<4>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<5>

§

type Output = UInt<5>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<6>

§

type Output = UInt<6>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<7>

§

type Output = UInt<7>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<8>

§

type Output = UInt<8>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl NegMod for UInt<9>

§

type Output = UInt<9>

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl<const LIMBS: usize> Not for UInt<LIMBS>

§

type Output = UInt<LIMBS>

The resulting type after applying the ! operator.
source§

fn not(self) -> <Self as Not>::Output

Performs the unary ! operation. Read more
source§

impl<const LIMBS: usize> Ord for UInt<LIMBS>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<const LIMBS: usize> PartialEq for UInt<LIMBS>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const LIMBS: usize> PartialOrd for UInt<LIMBS>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const LIMBS: usize> Rem<&NonZero<UInt<LIMBS>>> for &UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &NonZero<UInt<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<&NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &NonZero<UInt<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<UInt<LIMBS>>> for &UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<UInt<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

§

type Output = UInt<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<UInt<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> RemAssign<&NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

source§

fn rem_assign(&mut self, rhs: &NonZero<UInt<LIMBS>>)

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> RemAssign<NonZero<UInt<LIMBS>>> for UInt<LIMBS>
where UInt<LIMBS>: Integer,

source§

fn rem_assign(&mut self, rhs: NonZero<UInt<LIMBS>>)

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> Shl<usize> for &UInt<LIMBS>

source§

fn shl(self, rhs: usize) -> UInt<LIMBS>

NOTE: this operation is variable time with respect to rhs ONLY.

When used with a fixed rhs, this function is constant-time with respect to self.

§

type Output = UInt<LIMBS>

The resulting type after applying the << operator.
source§

impl<const LIMBS: usize> Shl<usize> for UInt<LIMBS>

source§

fn shl(self, rhs: usize) -> UInt<LIMBS>

NOTE: this operation is variable time with respect to rhs ONLY.

When used with a fixed rhs, this function is constant-time with respect to self.

§

type Output = UInt<LIMBS>

The resulting type after applying the << operator.
source§

impl<const LIMBS: usize> ShlAssign<usize> for UInt<LIMBS>

source§

fn shl_assign(&mut self, rhs: usize)

NOTE: this operation is variable time with respect to rhs ONLY.

When used with a fixed rhs, this function is constant-time with respect to self.

source§

impl<const LIMBS: usize> Shr<usize> for &UInt<LIMBS>

source§

fn shr(self, rhs: usize) -> UInt<LIMBS>

NOTE: this operation is variable time with respect to rhs ONLY.

When used with a fixed rhs, this function is constant-time with respect to self.

§

type Output = UInt<LIMBS>

The resulting type after applying the >> operator.
source§

impl<const LIMBS: usize> Shr<usize> for UInt<LIMBS>

source§

fn shr(self, rhs: usize) -> UInt<LIMBS>

NOTE: this operation is variable time with respect to rhs ONLY.

When used with a fixed rhs, this function is constant-time with respect to self.

§

type Output = UInt<LIMBS>

The resulting type after applying the >> operator.
source§

impl<const LIMBS: usize> ShrAssign<usize> for UInt<LIMBS>

source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
source§

impl SubMod for UInt<1>

§

type Output = UInt<1>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<10>

§

type Output = UInt<10>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<11>

§

type Output = UInt<11>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<12>

§

type Output = UInt<12>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<2>

§

type Output = UInt<2>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<3>

§

type Output = UInt<3>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<4>

§

type Output = UInt<4>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<5>

§

type Output = UInt<5>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<6>

§

type Output = UInt<6>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<7>

§

type Output = UInt<7>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<8>

§

type Output = UInt<8>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl SubMod for UInt<9>

§

type Output = UInt<9>

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl<const LIMBS: usize> UpperHex for UInt<LIMBS>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<const LIMBS: usize> Zero for UInt<LIMBS>

source§

const ZERO: Self = Self::ZERO

The value 0.
source§

fn is_zero(&self) -> Choice

Determine if this value is equal to zero. Read more
source§

impl<const LIMBS: usize> Copy for UInt<LIMBS>

source§

impl<const LIMBS: usize> Eq for UInt<LIMBS>

Auto Trait Implementations§

§

impl<const LIMBS: usize> RefUnwindSafe for UInt<LIMBS>

§

impl<const LIMBS: usize> Send for UInt<LIMBS>

§

impl<const LIMBS: usize> Sync for UInt<LIMBS>

§

impl<const LIMBS: usize> Unpin for UInt<LIMBS>

§

impl<const LIMBS: usize> UnwindSafe for UInt<LIMBS>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.