#[repr(transparent)]pub struct Limb(pub Inner);Expand description
Big integers are represented as an array of smaller CPU word-size integers called “limbs”.
Tuple Fields§
§0: InnerImplementations§
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 wrapping_add(&self, rhs: Self) -> Self
pub const fn wrapping_add(&self, rhs: Self) -> Self
Perform wrapping addition, discarding overflow.
Sourcepub fn checked_add(&self, rhs: Self) -> CtOption<Self>
pub fn checked_add(&self, rhs: Self) -> CtOption<Self>
Perform checked addition, returning a CtOption which is_some only
if the operation did not 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 wrapping_mul(&self, rhs: Self) -> Self
pub const fn wrapping_mul(&self, rhs: Self) -> Self
Perform wrapping multiplication, discarding overflow.
Sourcepub fn checked_mul(&self, rhs: Self) -> CtOption<Self>
pub 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 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 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.
Sourcepub fn checked_sub(&self, rhs: Self) -> CtOption<Self>
pub fn checked_sub(&self, rhs: Self) -> CtOption<Self>
Perform checked subtraction, returning a CtOption which is_some
only if the operation did not overflow.
Trait Implementations§
Source§impl ConditionallySelectable for Limb
impl ConditionallySelectable for Limb
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 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
impl Copy for Limb
impl DefaultIsZeroes for Limb
zeroize only.