Expand description
Little-endian large integer type
Tuple Fields§
§0: [u64; 2]
Implementations§
source§impl U128
impl U128
sourcepub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
pub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
Convert from a decimal string.
sourcepub fn as_usize(&self) -> usize
pub fn as_usize(&self) -> usize
Conversion to usize with overflow checking
Panics
Panics if the number is larger than usize::max_value().
sourcepub fn index(&self, index: usize) -> u8
pub fn index(&self, index: usize) -> u8
Return specific byte in big-endian format.
Panics
Panics if index
exceeds the byte width of the number.
sourcepub fn to_big_endian(&self, bytes: &mut [u8])
pub fn to_big_endian(&self, bytes: &mut [u8])
Write to the slice in big-endian format.
sourcepub fn to_little_endian(&self, bytes: &mut [u8])
pub fn to_little_endian(&self, bytes: &mut [u8])
Write to the slice in little-endian format.
sourcepub fn pow(self, expon: Self) -> Self
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.
sourcepub fn overflowing_pow(self, expon: Self) -> (Self, bool)
pub fn overflowing_pow(self, expon: Self) -> (Self, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
sourcepub fn overflowing_add(self, other: U128) -> (U128, bool)
pub fn overflowing_add(self, other: U128) -> (U128, bool)
Optimized instructions
sourcepub fn saturating_add(self, other: U128) -> U128
pub fn saturating_add(self, other: U128) -> U128
Addition which saturates at the maximum value.
sourcepub fn overflowing_sub(self, other: U128) -> (U128, bool)
pub fn overflowing_sub(self, other: U128) -> (U128, bool)
Subtraction which underflows and returns a flag if it does.
sourcepub fn saturating_sub(self, other: U128) -> U128
pub fn saturating_sub(self, other: U128) -> U128
Subtraction which saturates at zero.
sourcepub fn overflowing_mul(self, other: U128) -> (U128, bool)
pub fn overflowing_mul(self, other: U128) -> (U128, bool)
Multiply with overflow, returning a flag if it does.
sourcepub fn saturating_mul(self, other: U128) -> U128
pub fn saturating_mul(self, other: U128) -> U128
Multiplication which saturates at the maximum value..
sourcepub fn overflowing_div(self, other: U128) -> (U128, bool)
pub fn overflowing_div(self, other: U128) -> (U128, bool)
Division with overflow
sourcepub fn overflowing_rem(self, other: U128) -> (U128, bool)
pub fn overflowing_rem(self, other: U128) -> (U128, bool)
Modulus with overflow.
sourcepub fn overflowing_neg(self) -> (U128, bool)
pub fn overflowing_neg(self) -> (U128, bool)
Negation with overflow.
Trait Implementations§
source§impl Decodable for U128
impl Decodable for U128
source§fn decode(rlp: &UntrustedRlp<'_>) -> Result<Self, DecoderError>
fn decode(rlp: &UntrustedRlp<'_>) -> Result<Self, DecoderError>
source§impl Ord for U128
impl Ord for U128
source§impl PartialOrd<U128> for U128
impl PartialOrd<U128> for U128
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more