pub struct Uint<const LEN: usize>(pub [u64; LEN]);
Expand description

Note: LEN must satisfy LEN > 0 and LEN.checked_mul(64usize).is_some(). The construction functions and some downstream functions check for these invariants. Users should preferrably use from_u64_array instead of direct tuple struct construction of the Uint, because the invariants are checked automatically by from_u64_array.

Tuple Fields

0: [u64; LEN]

Implementations

These functions directly correspond to the Rust standard unsigned integers.

Panics

If s >= Self::bw()

special functions

Returns the bitwidth of Self

Returns the least significant bit

Returns the most significant bit

Returns the number of leading zero bits

Returns the number of trailing zero bits

Returns the number of set ones

Returns the number of significant bits

Returns the number of significant u64 digits

Equality comparison

Less-than comparison

Less-or-equal comparison

Greater-than comparison

Greater-or-equal comparison

Returns a tuple of cin + (self * rhs) and the overflow. The intermediates are effectively zero extended.

Returns self + (lhs * rhs) and if overflow occured. The intermediates are effectively zero extended.

Returns a tuple of self + (lhs * rhs) and if overflow occured.

Returns a tuple of the quotient and remainder of self divided by div. div is zero extended. Returns None if div == 0.

because unwrap is not const on stable, this exists for checked_short_divide(..).unwrap()

Divides self by div and returns a tuple of the quotient to and remainder. Returns None if div.is_zero().

Randomly-assigns self using a rand_core::RngCore random number generator

Trait Implementations

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Performs the ^= operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

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

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

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

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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)

Uses borrowed data to replace owned data, usually by cloning. 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.