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
sourceimpl 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.
sourceimpl 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.
sourceimpl 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.
sourceimpl 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
sourceimpl CheckedAdd<Limb> for Limb
impl CheckedAdd<Limb> for Limb
sourceimpl CheckedMul<Limb> for Limb
impl CheckedMul<Limb> for Limb
sourceimpl CheckedSub<Limb> for Limb
impl CheckedSub<Limb> for Limb
sourceimpl ConditionallySelectable for Limb
impl ConditionallySelectable for Limb
sourceimpl ConstantTimeEq for Limb
impl ConstantTimeEq for Limb
sourceimpl ConstantTimeGreater for Limb
impl ConstantTimeGreater for Limb
sourceimpl ConstantTimeLess for Limb
impl ConstantTimeLess for Limb
sourceimpl Encoding for Limb
impl Encoding for Limb
sourcefn from_be_bytes(bytes: Self::Repr) -> Self
fn from_be_bytes(bytes: Self::Repr) -> Self
Decode from big endian bytes.
sourcefn from_le_bytes(bytes: Self::Repr) -> Self
fn from_le_bytes(bytes: Self::Repr) -> Self
Decode from little endian bytes.
sourcefn to_be_bytes(&self) -> Self::Repr
fn to_be_bytes(&self) -> Self::Repr
Encode to big endian bytes.
sourcefn to_le_bytes(&self) -> Self::Repr
fn to_le_bytes(&self) -> Self::Repr
Encode to little endian bytes.
sourceimpl From<Limb> for WideLimbUInt
impl From<Limb> for WideLimbUInt
sourcefn from(limb: Limb) -> WideLimbUInt
fn from(limb: Limb) -> WideLimbUInt
Converts to this type from the input type.
sourceimpl Ord for Limb
impl Ord for Limb
sourceimpl PartialOrd<Limb> for Limb
impl PartialOrd<Limb> for Limb
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl Copy for Limb
impl DefaultIsZeroes for Limb
zeroize
only.impl Eq for Limb
Auto Trait Implementations
impl RefUnwindSafe for Limb
impl Send for Limb
impl Sync for Limb
impl Unpin for Limb
impl UnwindSafe for Limb
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more