Struct bigint::U512
[−]
[src]
#[repr(C)]pub struct U512(pub [u64; 8]);
Little-endian large integer type
Methods
impl U512
[src]
fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
Convert from a decimal string.
fn low_u32(&self) -> u32
Conversion to u32
fn low_u64(&self) -> u64
Conversion to u64
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_usize(&self) -> usize
Conversion to usize with overflow checking
Panics
Panics if the number is larger than usize::max_value().
fn is_zero(&self) -> bool
Whether this is zero.
fn bits(&self) -> usize
Return the least number of bits needed to represent the number
fn bit(&self, index: usize) -> bool
fn byte(&self, index: usize) -> u8
fn index(&self, index: usize) -> u8
Return specific byte in big-endian format.
Panics
Panics if index
exceeds the byte width of the number.
fn to_big_endian(&self, bytes: &mut [u8])
Write to the slice in big-endian format.
fn to_little_endian(&self, bytes: &mut [u8])
Write to the slice in little-endian format.
fn exp10(n: usize) -> Self
fn zero() -> Self
Zero (additive identity) of this type.
fn one() -> Self
One (multiplicative identity) of this type.
fn max_value() -> Self
The maximum value which can be inhabited by this type.
fn min_value() -> Self
The minimum value which can be inhabited by this type.
fn pow(self, expon: Self) -> Self
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
Panics
Panics if the result overflows the type.
fn overflowing_pow(self, expon: Self) -> (Self, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_add(self, other: U512) -> (U512, bool)
Optimized instructions
fn saturating_add(self, other: U512) -> U512
Addition which saturates at the maximum value.
fn overflowing_sub(self, other: U512) -> (U512, bool)
Subtraction which underflows and returns a flag if it does.
fn saturating_sub(self, other: U512) -> U512
Subtraction which saturates at zero.
fn overflowing_mul(self, other: U512) -> (U512, bool)
Multiply with overflow, returning a flag if it does.
fn saturating_mul(self, other: U512) -> U512
Multiplication which saturates at the maximum value..
fn overflowing_div(self, other: U512) -> (U512, bool)
Division with overflow
fn overflowing_rem(self, other: U512) -> (U512, bool)
Modulus with overflow.
fn overflowing_neg(self) -> (U512, bool)
Negation with overflow.
Trait Implementations
impl Copy for U512
[src]
impl Clone for U512
[src]
fn clone(&self) -> U512
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Eq for U512
[src]
impl PartialEq for U512
[src]
fn eq(&self, __arg_0: &U512) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &U512) -> bool
This method tests for !=
.
impl Hash for U512
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for U512
[src]
impl From<u64> for U512
[src]
impl From<u8> for U512
[src]
impl From<u16> for U512
[src]
impl From<u32> for U512
[src]
impl From<usize> for U512
[src]
impl From<i64> for U512
[src]
impl From<i8> for U512
[src]
impl From<i16> for U512
[src]
impl From<i32> for U512
[src]
impl From<isize> for U512
[src]
impl<'a> From<&'a [u8]> for U512
[src]
impl FromStr for U512
[src]
type Err = ParseHexError
The associated error which can be returned from parsing.
fn from_str(value: &str) -> Result<U512, Self::Err>
Parses a string s
to return a value of this type. Read more
impl Add<U512> for U512
[src]
type Output = U512
The resulting type after applying the +
operator
fn add(self, other: U512) -> U512
The method for the +
operator
impl Sub<U512> for U512
[src]
type Output = U512
The resulting type after applying the -
operator
fn sub(self, other: U512) -> U512
The method for the -
operator
impl Mul<U512> for U512
[src]
type Output = U512
The resulting type after applying the *
operator
fn mul(self, other: U512) -> U512
The method for the *
operator
impl Div<U512> for U512
[src]
type Output = U512
The resulting type after applying the /
operator
fn div(self, other: U512) -> U512
The method for the /
operator
impl Rem<U512> for U512
[src]
type Output = U512
The resulting type after applying the %
operator
fn rem(self, other: U512) -> U512
The method for the %
operator
impl BitAnd<U512> for U512
[src]
type Output = U512
The resulting type after applying the &
operator
fn bitand(self, other: U512) -> U512
The method for the &
operator
impl BitXor<U512> for U512
[src]
type Output = U512
The resulting type after applying the ^
operator
fn bitxor(self, other: U512) -> U512
The method for the ^
operator
impl BitOr<U512> for U512
[src]
type Output = U512
The resulting type after applying the |
operator
fn bitor(self, other: U512) -> U512
The method for the |
operator
impl Not for U512
[src]
type Output = U512
The resulting type after applying the !
operator
fn not(self) -> U512
The method for the unary !
operator
impl Shl<usize> for U512
[src]
type Output = U512
The resulting type after applying the <<
operator
fn shl(self, shift: usize) -> U512
The method for the <<
operator
impl Shr<usize> for U512
[src]
type Output = U512
The resulting type after applying the >>
operator
fn shr(self, shift: usize) -> U512
The method for the >>
operator
impl Ord for U512
[src]
fn cmp(&self, other: &U512) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
ord_max_min
)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
ord_max_min
)Compares and returns the minimum of two values. Read more
impl PartialOrd for U512
[src]
fn partial_cmp(&self, other: &U512) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
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
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more