#[repr(transparent)]
pub struct Limb(pub LimbUInt);
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 saturating addition.
Perform wrapping addition, discarding overflow.
Calculate the number of bits needed to represent this number.
Is this limb an odd number?
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.
Performs an equality check in variable-time.
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)
Computes self + (b * c) + carry
, returning the result along with the new carry.
Perform saturating multiplication.
Perform wrapping multiplication, discarding overflow.
Computes self - (rhs + borrow)
, returning the result along with the new borrow.
Perform saturating subtraction.
Perform wrapping subtraction, discarding underflow and wrapping around
the boundary of the type.
Maximum value this Limb
can express.
Size of the inner integer in bits.
Size of the inner integer in bytes.
The resulting type after applying the &
operator.
The resulting type after applying the |
operator.
The resulting type after applying the ^
operator.
Perform checked subtraction, returning a CtOption
which is_some
only if the operation did not overflow. Read more
Perform checked multiplication, returning a CtOption
which is_some
only if the operation did not overflow. Read more
Perform checked subtraction, returning a CtOption
which is_some
only if the operation did not underflow. Read more
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.
Formats the value using the given formatter.
The resulting type after applying the !
operator.
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
This is supported on crate feature rand_core
only.
Generate a cryptographically secure random value.
This is supported on crate feature rand_core
only.
Generate a cryptographically secure random number which is less than
a given modulus
. Read more
Formats the value using the given formatter.
Determine if this value is equal to zero. Read more
This is supported on crate feature zeroize
only.
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
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