#[repr(transparent)]pub struct Limb(pub Word);
Expand description
Tuple Fields§
§0: Word
Implementations§
Source§impl Limb
impl Limb
Sourcepub const fn overflowing_add(self, rhs: Limb) -> (Limb, Limb)
pub const fn overflowing_add(self, rhs: Limb) -> (Limb, Limb)
Computes self + rhs
, returning the result along with the carry.
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 const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Calculate the number of leading zeros in the binary representation of this number.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Calculate the number of trailing zeros in the binary representation of this number.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Calculate the number of trailing ones the binary representation of this number.
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 wrapping_neg(self) -> Self
pub const fn wrapping_neg(self) -> Self
Perform wrapping negation.
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.
Source§impl Limb
impl Limb
Sourcepub const fn to_nz(self) -> ConstCtOption<NonZero<Self>>
pub const fn to_nz(self) -> ConstCtOption<NonZero<Self>>
Convert to a NonZero<Limb>
.
Returns some if the original value is non-zero, and false otherwise.
Trait Implementations§
Source§impl BitAndAssign<&Limb> for Limb
impl BitAndAssign<&Limb> for Limb
Source§fn bitand_assign(&mut self, rhs: &Limb)
fn bitand_assign(&mut self, rhs: &Limb)
&=
operation. Read moreSource§impl BitAndAssign for Limb
impl BitAndAssign for Limb
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moreSource§impl BitOrAssign<&Limb> for Limb
impl BitOrAssign<&Limb> for Limb
Source§fn bitor_assign(&mut self, other: &Self)
fn bitor_assign(&mut self, other: &Self)
|=
operation. Read moreSource§impl BitOrAssign for Limb
impl BitOrAssign for Limb
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|=
operation. Read moreSource§impl BitXorAssign for Limb
impl BitXorAssign for Limb
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^=
operation. Read moreSource§impl CheckedAdd for Limb
impl CheckedAdd for Limb
Source§fn checked_add(&self, rhs: &Self) -> CtOption<Self>
fn checked_add(&self, rhs: &Self) -> CtOption<Self>
CtOption
which is_some
only if the operation
did not overflow.Source§impl CheckedMul for Limb
impl CheckedMul for Limb
Source§fn checked_mul(&self, rhs: &Self) -> CtOption<Self>
fn checked_mul(&self, rhs: &Self) -> CtOption<Self>
CtOption
which is_some
only if the operation did not overflow.Source§impl CheckedSub for Limb
impl CheckedSub for Limb
Source§fn checked_sub(&self, rhs: &Self) -> CtOption<Self>
fn checked_sub(&self, rhs: &Self) -> CtOption<Self>
CtOption
which is_some
only if the operation did not underflow.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
Source§impl<'de> Deserialize<'de> for Limb
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Limb
serde
only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 Ord for Limb
impl Ord for Limb
Source§impl PartialOrd for Limb
impl PartialOrd for Limb
Source§impl ShlAssign<i32> for Limb
impl ShlAssign<i32> for Limb
Source§fn shl_assign(&mut self, shift: i32)
fn shl_assign(&mut self, shift: i32)
<<=
operation. Read moreSource§impl ShlAssign<u32> for Limb
impl ShlAssign<u32> for Limb
Source§fn shl_assign(&mut self, shift: u32)
fn shl_assign(&mut self, shift: u32)
<<=
operation. Read moreSource§impl ShlAssign<usize> for Limb
impl ShlAssign<usize> for Limb
Source§fn shl_assign(&mut self, shift: usize)
fn shl_assign(&mut self, shift: usize)
<<=
operation. Read moreSource§impl ShrAssign<i32> for Limb
impl ShrAssign<i32> for Limb
Source§fn shr_assign(&mut self, shift: i32)
fn shr_assign(&mut self, shift: i32)
>>=
operation. Read moreSource§impl ShrAssign<u32> for Limb
impl ShrAssign<u32> for Limb
Source§fn shr_assign(&mut self, shift: u32)
fn shr_assign(&mut self, shift: u32)
>>=
operation. Read moreSource§impl ShrAssign<usize> for Limb
impl ShrAssign<usize> for Limb
Source§fn shr_assign(&mut self, shift: usize)
fn shr_assign(&mut self, shift: usize)
>>=
operation. Read moreSource§impl WrappingAdd for Limb
impl WrappingAdd for Limb
Source§fn wrapping_add(&self, v: &Self) -> Self
fn wrapping_add(&self, v: &Self) -> Self
self + other
, wrapping around at the boundary of
the type.Source§impl WrappingMul for Limb
impl WrappingMul for Limb
Source§fn wrapping_mul(&self, v: &Self) -> Self
fn wrapping_mul(&self, v: &Self) -> Self
self * other
, wrapping around at the boundary
of the type.Source§impl WrappingNeg for Limb
impl WrappingNeg for Limb
Source§fn wrapping_neg(&self) -> Self
fn wrapping_neg(&self) -> Self
-self
,
wrapping around at the boundary of the type. Read moreSource§impl WrappingShl for Limb
impl WrappingShl for Limb
Source§impl WrappingShr for Limb
impl WrappingShr for Limb
Source§impl WrappingSub for Limb
impl WrappingSub for Limb
Source§fn wrapping_sub(&self, v: &Self) -> Self
fn wrapping_sub(&self, v: &Self) -> Self
self - other
, wrapping around at the boundary
of the type.impl Copy for Limb
impl DefaultIsZeroes for Limb
zeroize
only.