Struct kaspa_math::Uint192
source · pub struct Uint192(pub [u64; 3]);Expand description
Little-endian large integer type
Tuple Fields§
§0: [u64; 3]Implementations§
source§impl Uint192
impl Uint192
pub const ZERO: Self = _
pub const MIN: Self = Self::ZERO
pub const MAX: Self = _
pub const BITS: u32 = 192u32
pub const BYTES: usize = 24usize
pub const LIMBS: usize = 3usize
pub fn from_u64(n: u64) -> Self
pub fn from_u128(n: u128) -> Self
pub fn as_u128(self) -> u128
pub fn as_u64(self) -> u64
pub fn is_zero(self) -> bool
pub fn leading_zeros(&self) -> u32
pub fn overflowing_shl(self, s: u32) -> (Self, bool)
pub fn wrapping_shl(self, s: u32) -> Self
pub fn overflowing_shr(self, s: u32) -> (Self, bool)
pub fn overflowing_add(self, other: Self) -> (Self, bool)
pub fn overflowing_add_u64(self, other: u64) -> (Self, bool)
pub fn overflowing_sub(self, other: Self) -> (Self, bool)
sourcepub fn overflowing_mul_u64(self, other: u64) -> (Self, bool)
pub fn overflowing_mul_u64(self, other: u64) -> (Self, bool)
Multiplication by u64
pub fn carrying_mul_u64(self, other: u64) -> (Self, u64)
pub fn overflowing_mul(self, other: Self) -> (Self, bool)
sourcepub fn from_le_bytes(bytes: [u8; 24]) -> Self
pub fn from_le_bytes(bytes: [u8; 24]) -> Self
Creates big integer value from a byte slice using little-endian encoding
sourcepub fn from_be_bytes(bytes: [u8; 24]) -> Self
pub fn from_be_bytes(bytes: [u8; 24]) -> Self
Creates big integer value from a byte slice using big-endian encoding
sourcepub fn to_le_bytes(self) -> [u8; 24]
pub fn to_le_bytes(self) -> [u8; 24]
Convert’s the Uint into little endian byte array
sourcepub fn to_be_bytes(self) -> [u8; 24]
pub fn to_be_bytes(self) -> [u8; 24]
Convert’s the Uint into big endian byte array
pub fn to_be_bytes_var(self) -> Vec<u8>
pub fn div_rem_u64(self, other: u64) -> (Self, u64)
pub fn as_f64(&self) -> f64
pub fn div_rem(self, other: Self) -> (Self, Self)
sourcepub fn mod_inverse(self, prime: Self) -> Option<Self>
pub fn mod_inverse(self, prime: Self) -> Option<Self>
Assumes self < prime
pub fn iter_be_bits(self) -> impl ExactSizeIterator<Item = bool> + FusedIterator
sourcepub fn from_hex(hex: &str) -> Result<Self, Error>
pub fn from_hex(hex: &str) -> Result<Self, Error>
Converts a Self::BYTES*2 hex string interpreted as big endian, into a Uint
pub fn from_be_bytes_var(bytes: &[u8]) -> Result<Self, TryFromSliceError>
Trait Implementations§
source§impl BorshDeserialize for Uint192
impl BorshDeserialize for Uint192
source§impl BorshSchema for Uint192where
[u64; 3]: BorshSchema,
impl BorshSchema for Uint192where [u64; 3]: BorshSchema,
source§fn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
source§fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively( definitions: &mut HashMap<Declaration, Definition> )
Recursively, using DFS, add type definitions required for this type. For primitive types
this is an empty map. Type definition explains how to serialize/deserialize a type.
source§fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition, RandomState> )
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
source§impl BorshSerialize for Uint192
impl BorshSerialize for Uint192
source§impl<'de> Deserialize<'de> for Uint192
impl<'de> Deserialize<'de> for Uint192
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Uint192
impl Ord for Uint192
source§impl PartialEq<Uint192> for Uint192
impl PartialEq<Uint192> for Uint192
source§impl PartialEq<u128> for Uint192
impl PartialEq<u128> for Uint192
source§impl PartialOrd<Uint192> for Uint192
impl PartialOrd<Uint192> for Uint192
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl PartialOrd<u128> for Uint192
impl PartialOrd<u128> for Uint192
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl PartialOrd<u64> for Uint192
impl PartialOrd<u64> for Uint192
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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