Struct crypto_bigint::limb::Limb[][src]

#[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: Inner

Implementations

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.

Calculates a & b.

Calculates a | b.

Is this limb equal to zero?

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)

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.

This is supported on crate feature rand only.

Generate a random limb

The value 0.

The value 1.

Maximum value this Limb can express.

Trait Implementations

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Select a or b according to choice. 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

Determine if two items are equal. Read more

Determine whether self > other. Read more

Determine whether self < other. 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.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Formats the value using the given formatter.

This method returns an Ordering between self and other. Read more

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

Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

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.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more