pub struct Int1024(/* private fields */);Expand description
Hand-rolled fixed-width two’s-complement signed integer.
Implementations§
Source§impl Int1024
impl Int1024
Sourcepub const fn from_str_radix(s: &str, radix: u32) -> Result<Int1024, ()>
pub const fn from_str_radix(s: &str, radix: u32) -> Result<Int1024, ()>
Parse a signed decimal magnitude from s. Mirrors
i128::from_str_radix in shape: accepts an optional
leading -, then ASCII digits. Currently only radix == 10 is supported; any other value returns Err(()).
const fn so the consts module can parse the build-
time generated string literals.
Sourcepub const fn pow(self, exp: u32) -> Int1024
pub const fn pow(self, exp: u32) -> Int1024
Integer power: self^exp via right-to-left binary
exponentiation. Wraps on overflow (same semantics as
i128::wrapping_pow). const fn; runs at compile
time when both inputs are const.
Sourcepub const fn to_i128_checked(self) -> Option<i128>
pub const fn to_i128_checked(self) -> Option<i128>
Exact i128 value, or None if it does not fit.
Sourcepub const fn to_u128_checked(self) -> Option<u128>
pub const fn to_u128_checked(self) -> Option<u128>
Exact u128 value, or None if negative / too large.
Sourcepub const fn from_limbs_le(limbs: [u64; 16]) -> Int1024
pub const fn from_limbs_le(limbs: [u64; 16]) -> Int1024
Builds directly from the u64 limb array
([u64; $L]). Limbs are interpreted as a
little-endian two’s-complement signed integer. Wire-
format compatible with the historic [u128; N] shape
on little-endian targets — same byte sequence.
Sourcepub const fn limbs_le(self) -> [u64; 16]
pub const fn limbs_le(self) -> [u64; 16]
Read-only access to the underlying u64 limbs.
Symmetric with Self::from_limbs_le.