Struct crypto_bigint::Limb
source · #[repr(transparent)]pub struct Limb(pub LimbUInt);
Expand description
Big integers are represented as an array of smaller CPU word-size integers called “limbs”.
Tuple Fields§
§0: LimbUInt
Implementations§
source§impl Limb
impl Limb
sourcepub const fn adc(self, rhs: Limb, carry: Limb) -> (Limb, Limb)
pub const fn adc(self, rhs: Limb, carry: Limb) -> (Limb, Limb)
Computes self + rhs + carry
, returning the result along with the new carry.
sourcepub const fn saturating_add(&self, rhs: Self) -> Self
pub const fn saturating_add(&self, rhs: Self) -> Self
Perform saturating addition.
sourcepub const fn wrapping_add(&self, rhs: Self) -> Self
pub const fn wrapping_add(&self, rhs: Self) -> Self
Perform wrapping addition, discarding overflow.
source§impl Limb
impl Limb
sourcepub fn cmp_vartime(&self, other: &Self) -> Ordering
pub fn cmp_vartime(&self, other: &Self) -> Ordering
Perform a comparison of the inner value in variable-time.
Note that the PartialOrd
and Ord
impls wrap constant-time
comparisons using the subtle
crate.
sourcepub const fn eq_vartime(&self, other: &Self) -> bool
pub const fn eq_vartime(&self, other: &Self) -> bool
Performs an equality check in variable-time.
source§impl Limb
impl Limb
sourcepub const fn mac(self, b: Limb, c: Limb, carry: Limb) -> (Limb, Limb)
pub const fn mac(self, b: Limb, c: Limb, carry: Limb) -> (Limb, Limb)
Computes self + (b * c) + carry
, returning the result along with the new carry.
sourcepub const fn saturating_mul(&self, rhs: Self) -> Self
pub const fn saturating_mul(&self, rhs: Self) -> Self
Perform saturating multiplication.
sourcepub const fn wrapping_mul(&self, rhs: Self) -> Self
pub const fn wrapping_mul(&self, rhs: Self) -> Self
Perform wrapping multiplication, discarding overflow.
source§impl Limb
impl Limb
sourcepub const fn sbb(self, rhs: Limb, borrow: Limb) -> (Limb, Limb)
pub const fn sbb(self, rhs: Limb, borrow: Limb) -> (Limb, Limb)
Computes self - (rhs + borrow)
, returning the result along with the new borrow.
sourcepub const fn saturating_sub(&self, rhs: Self) -> Self
pub const fn saturating_sub(&self, rhs: Self) -> Self
Perform saturating subtraction.
sourcepub const fn wrapping_sub(&self, rhs: Self) -> Self
pub const fn wrapping_sub(&self, rhs: Self) -> Self
Perform wrapping subtraction, discarding underflow and wrapping around the boundary of the type.
Trait Implementations§
source§impl CheckedAdd<Limb> for Limb
impl CheckedAdd<Limb> for Limb
source§impl CheckedMul<Limb> for Limb
impl CheckedMul<Limb> for Limb
source§impl CheckedSub<Limb> for Limb
impl CheckedSub<Limb> for Limb
source§impl ConditionallySelectable for Limb
impl ConditionallySelectable for Limb
source§impl ConstantTimeEq for Limb
impl ConstantTimeEq for Limb
source§impl ConstantTimeGreater for Limb
impl ConstantTimeGreater for Limb
source§impl ConstantTimeLess for Limb
impl ConstantTimeLess for Limb
source§impl Encoding for Limb
impl Encoding for Limb
source§fn from_be_bytes(bytes: Self::Repr) -> Self
fn from_be_bytes(bytes: Self::Repr) -> Self
source§fn from_le_bytes(bytes: Self::Repr) -> Self
fn from_le_bytes(bytes: Self::Repr) -> Self
source§fn to_be_bytes(&self) -> Self::Repr
fn to_be_bytes(&self) -> Self::Repr
source§fn to_le_bytes(&self) -> Self::Repr
fn to_le_bytes(&self) -> Self::Repr
source§impl From<Limb> for WideLimbUInt
impl From<Limb> for WideLimbUInt
source§fn from(limb: Limb) -> WideLimbUInt
fn from(limb: Limb) -> WideLimbUInt
source§impl Ord for Limb
impl Ord for Limb
source§impl PartialOrd<Limb> for Limb
impl PartialOrd<Limb> for Limb
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more