Struct kaspa_math::Uint3072
source · pub struct Uint3072(pub [u64; 48]);Expand description
Little-endian large integer type
Tuple Fields§
§0: [u64; 48]Implementations§
source§impl Uint3072
impl Uint3072
pub const ZERO: Self = _
pub const MIN: Self = Self::ZERO
pub const MAX: Self = _
pub const BITS: u32 = 3_072u32
pub const BYTES: usize = 384usize
pub const LIMBS: usize = 48usize
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; 384]) -> Self
pub fn from_le_bytes(bytes: [u8; 384]) -> Self
Creates big integer value from a byte slice using little-endian encoding
sourcepub fn from_be_bytes(bytes: [u8; 384]) -> Self
pub fn from_be_bytes(bytes: [u8; 384]) -> Self
Creates big integer value from a byte slice using big-endian encoding
sourcepub fn to_le_bytes(self) -> [u8; 384]
pub fn to_le_bytes(self) -> [u8; 384]
Convert’s the Uint into little endian byte array
sourcepub fn to_be_bytes(self) -> [u8; 384]
pub fn to_be_bytes(self) -> [u8; 384]
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<'de> Deserialize<'de> for Uint3072
impl<'de> Deserialize<'de> for Uint3072
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 Uint3072
impl Ord for Uint3072
source§impl PartialEq<Uint3072> for Uint3072
impl PartialEq<Uint3072> for Uint3072
source§impl PartialEq<u128> for Uint3072
impl PartialEq<u128> for Uint3072
source§impl PartialOrd<Uint3072> for Uint3072
impl PartialOrd<Uint3072> for Uint3072
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 Uint3072
impl PartialOrd<u128> for Uint3072
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 Uint3072
impl PartialOrd<u64> for Uint3072
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