#[repr(transparent)]
pub struct Limb(_);
Expand description
Big integers are represented as an array of smaller CPU word-size integers
called “limbs”.
Computes self + rhs + carry
, returning the result along with the new carry.
Perform wrapping addition, discarding overflow.
Perform checked addition, returning a CtOption
which is_some
only
if the operation did not overflow.
Is this limb equal to zero?
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.
pub const fn from_u8(n: u8) -> Self
Create a Limb
from a u8
integer (const-friendly)
Create a Limb
from a u16
integer (const-friendly)
Create a Limb
from a u32
integer (const-friendly)
This is supported on 64-bit only.
Create a Limb
from a u64
integer (const-friendly)
Computes self + (b * c) + carry
, returning the result along with the new carry.
Perform wrapping multiplication, discarding overflow.
Perform checked multiplication, returning a CtOption
which is_some
only if the operation did not overflow.
Computes self - (rhs + borrow)
, returning the result along with the new borrow.
Perform wrapping subtraction, discarding underflow and wrapping around
the boundary of the type.
Perform checked subtraction, returning a CtOption
which is_some
only if the operation did not overflow.
Maximum value this Limb
can express.
Performs copy-assignment from source
. Read more
Conditionally assign other
to self
, according to choice
. Read more
Conditionally swap self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Size of this integer in bits.
Size of this integer in bytes.
Byte array representation.
Decode from big endian bytes.
Decode from little endian bytes.
Encode to big endian bytes.
Encode to little endian bytes.
impl From<u64> for Limb
This is supported on 64-bit only.
Formats the value using the given formatter.
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
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
Formats the value using the given formatter.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
Zero out this object from memory using Rust intrinsics which ensure the
zeroization operation is not “optimized away” by the compiler. Read more