Struct bigint::uint::U256 [−][src]
#[repr(C)]pub struct U256(pub [u64; 4]);
Little-endian large integer type
Methods
impl U256
[src]
impl U256
pub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
[src]
pub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
Convert from a decimal string.
pub fn low_u32(&self) -> u32
[src]
pub fn low_u32(&self) -> u32
Conversion to u32
pub fn low_u64(&self) -> u64
[src]
pub fn low_u64(&self) -> u64
Conversion to u64
pub fn as_u32(&self) -> u32
[src]
pub fn as_u32(&self) -> u32
pub fn as_u64(&self) -> u64
[src]
pub fn as_u64(&self) -> u64
pub fn is_zero(&self) -> bool
[src]
pub fn is_zero(&self) -> bool
Whether this is zero.
pub fn bits(&self) -> usize
[src]
pub fn bits(&self) -> usize
Return the least number of bits needed to represent the number
pub fn bit(&self, index: usize) -> bool
[src]
pub fn bit(&self, index: usize) -> bool
pub fn leading_zeros(&self) -> u32
[src]
pub fn leading_zeros(&self) -> u32
Returns the number of leading zeros in the binary representation of self.
pub fn trailing_zeros(&self) -> u32
[src]
pub fn trailing_zeros(&self) -> u32
Returns the number of leading zeros in the binary representation of self.
pub fn byte(&self, index: usize) -> u8
[src]
pub fn byte(&self, index: usize) -> u8
pub fn to_big_endian(&self, bytes: &mut [u8])
[src]
pub fn to_big_endian(&self, bytes: &mut [u8])
Write to the slice in big-endian format.
pub fn to_little_endian(&self, bytes: &mut [u8])
[src]
pub fn to_little_endian(&self, bytes: &mut [u8])
Write to the slice in little-endian format.
pub fn exp10(n: usize) -> Self
[src]
pub fn exp10(n: usize) -> Self
pub fn zero() -> Self
[src]
pub fn zero() -> Self
Zero (additive identity) of this type.
pub fn one() -> Self
[src]
pub fn one() -> Self
One (multiplicative identity) of this type.
pub fn max_value() -> Self
[src]
pub fn max_value() -> Self
The maximum value which can be inhabited by this type.
pub fn pow(self, expon: Self) -> Self
[src]
pub 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.
pub fn overflowing_pow(self, expon: Self) -> (Self, bool)
[src]
pub fn overflowing_pow(self, expon: Self) -> (Self, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
pub fn overflowing_add(self, other: U256) -> (U256, bool)
[src]
pub fn overflowing_add(self, other: U256) -> (U256, bool)
Optimized instructions
pub fn saturating_add(self, other: U256) -> U256
[src]
pub fn saturating_add(self, other: U256) -> U256
Addition which saturates at the maximum value.
pub fn overflowing_sub(self, other: U256) -> (U256, bool)
[src]
pub fn overflowing_sub(self, other: U256) -> (U256, bool)
Subtraction which underflows and returns a flag if it does.
pub fn saturating_sub(self, other: U256) -> U256
[src]
pub fn saturating_sub(self, other: U256) -> U256
Subtraction which saturates at zero.
pub fn overflowing_mul(self, other: U256) -> (U256, bool)
[src]
pub fn overflowing_mul(self, other: U256) -> (U256, bool)
Multiply with overflow, returning a flag if it does.
pub fn saturating_mul(self, other: U256) -> U256
[src]
pub fn saturating_mul(self, other: U256) -> U256
Multiplication which saturates at the maximum value..
pub fn overflowing_div(self, other: U256) -> (U256, bool)
[src]
pub fn overflowing_div(self, other: U256) -> (U256, bool)
Division with overflow
pub fn overflowing_rem(self, other: U256) -> (U256, bool)
[src]
pub fn overflowing_rem(self, other: U256) -> (U256, bool)
Modulus with overflow.
pub fn overflowing_neg(self) -> (U256, bool)
[src]
pub fn overflowing_neg(self) -> (U256, bool)
Negation with overflow.
pub fn from_big_endian(slice: &[u8]) -> Self
[src]
pub fn from_big_endian(slice: &[u8]) -> Self
Converts from big endian representation bytes in memory
Can also be used as (&slice).into(), as it is default From
slice implementation for U256
pub fn from_little_endian(slice: &[u8]) -> Self
[src]
pub fn from_little_endian(slice: &[u8]) -> Self
Converts from little endian representation bytes in memory
impl U256
[src]
impl U256
pub fn full_mul(self, other: U256) -> U512
[src]
pub fn full_mul(self, other: U256) -> U512
Multiplies two 256-bit integers to produce full 512-bit integer No overflow possible
pub fn mod_inverse(self, p: Self) -> Self
[src]
pub fn mod_inverse(self, p: Self) -> Self
Find modular inverse by modulo p
Trait Implementations
impl Copy for U256
[src]
impl Copy for U256
impl Clone for U256
[src]
impl Clone for U256
fn clone(&self) -> U256
[src]
fn clone(&self) -> U256
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for U256
[src]
impl Eq for U256
impl PartialEq for U256
[src]
impl PartialEq for U256
fn eq(&self, other: &U256) -> bool
[src]
fn eq(&self, other: &U256) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &U256) -> bool
[src]
fn ne(&self, other: &U256) -> bool
This method tests for !=
.
impl Hash for U256
[src]
impl Hash for U256
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &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[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for U256
[src]
impl Default for U256
impl From<u64> for U256
[src]
impl From<u64> for U256
impl From<u8> for U256
[src]
impl From<u8> for U256
impl From<u16> for U256
[src]
impl From<u16> for U256
impl From<u32> for U256
[src]
impl From<u32> for U256
impl From<usize> for U256
[src]
impl From<usize> for U256
impl From<i64> for U256
[src]
impl From<i64> for U256
impl From<i8> for U256
[src]
impl From<i8> for U256
impl From<i16> for U256
[src]
impl From<i16> for U256
impl From<i32> for U256
[src]
impl From<i32> for U256
impl From<isize> for U256
[src]
impl From<isize> for U256
impl<'a> From<&'a [u8]> for U256
[src]
impl<'a> From<&'a [u8]> for U256
impl Add<U256> for U256
[src]
impl Add<U256> for U256
type Output = U256
The resulting type after applying the +
operator.
fn add(self, other: U256) -> U256
[src]
fn add(self, other: U256) -> U256
Performs the +
operation.
impl Sub<U256> for U256
[src]
impl Sub<U256> for U256
type Output = U256
The resulting type after applying the -
operator.
fn sub(self, other: U256) -> U256
[src]
fn sub(self, other: U256) -> U256
Performs the -
operation.
impl Mul<U256> for U256
[src]
impl Mul<U256> for U256
type Output = U256
The resulting type after applying the *
operator.
fn mul(self, other: U256) -> U256
[src]
fn mul(self, other: U256) -> U256
Performs the *
operation.
impl Div<U256> for U256
[src]
impl Div<U256> for U256
type Output = U256
The resulting type after applying the /
operator.
fn div(self, other: U256) -> U256
[src]
fn div(self, other: U256) -> U256
Performs the /
operation.
impl Rem<U256> for U256
[src]
impl Rem<U256> for U256
type Output = U256
The resulting type after applying the %
operator.
fn rem(self, other: U256) -> U256
[src]
fn rem(self, other: U256) -> U256
Performs the %
operation.
impl BitAnd<U256> for U256
[src]
impl BitAnd<U256> for U256
type Output = U256
The resulting type after applying the &
operator.
fn bitand(self, other: U256) -> U256
[src]
fn bitand(self, other: U256) -> U256
Performs the &
operation.
impl BitXor<U256> for U256
[src]
impl BitXor<U256> for U256
type Output = U256
The resulting type after applying the ^
operator.
fn bitxor(self, other: U256) -> U256
[src]
fn bitxor(self, other: U256) -> U256
Performs the ^
operation.
impl BitOr<U256> for U256
[src]
impl BitOr<U256> for U256
type Output = U256
The resulting type after applying the |
operator.
fn bitor(self, other: U256) -> U256
[src]
fn bitor(self, other: U256) -> U256
Performs the |
operation.
impl Not for U256
[src]
impl Not for U256
type Output = U256
The resulting type after applying the !
operator.
fn not(self) -> U256
[src]
fn not(self) -> U256
Performs the unary !
operation.
impl Shl<usize> for U256
[src]
impl Shl<usize> for U256
type Output = U256
The resulting type after applying the <<
operator.
fn shl(self, shift: usize) -> U256
[src]
fn shl(self, shift: usize) -> U256
Performs the <<
operation.
impl Shr<usize> for U256
[src]
impl Shr<usize> for U256
type Output = U256
The resulting type after applying the >>
operator.
fn shr(self, shift: usize) -> U256
[src]
fn shr(self, shift: usize) -> U256
Performs the >>
operation.
impl Ord for U256
[src]
impl Ord for U256
fn cmp(&self, other: &U256) -> Ordering
[src]
fn cmp(&self, other: &U256) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for U256
[src]
impl PartialOrd for U256
fn partial_cmp(&self, other: &U256) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &U256) -> 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[src]
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
1.0.0[src]
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
1.0.0[src]
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
1.0.0[src]
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
impl From<U256> for U512
[src]
impl From<U256> for U512
impl From<U512> for U256
[src]
impl From<U512> for U256
impl<'a> From<&'a U256> for U512
[src]
impl<'a> From<&'a U256> for U512
impl<'a> From<&'a U512> for U256
[src]
impl<'a> From<&'a U512> for U256
impl From<U256> for U128
[src]
impl From<U256> for U128
impl From<U128> for U256
[src]
impl From<U128> for U256
impl From<U256> for u64
[src]
impl From<U256> for u64
impl From<U256> for u32
[src]
impl From<U256> for u32
impl<'a> From<&'a [u8; 32]> for U256
[src]
impl<'a> From<&'a [u8; 32]> for U256
impl From<[u8; 32]> for U256
[src]
impl From<[u8; 32]> for U256
impl From<U256> for [u8; 32]
[src]
impl From<U256> for [u8; 32]