pub struct Int4096(/* private fields */);Expand description
Hand-rolled fixed-width two’s-complement signed integer.
Implementations§
Source§impl Int4096
impl Int4096
Sourcepub const fn from_str_radix(s: &str, radix: u32) -> Result<Int4096, ()>
pub const fn from_str_radix(s: &str, radix: u32) -> Result<Int4096, ()>
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) -> Int4096
pub const fn pow(self, exp: u32) -> Int4096
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: [u128; 32]) -> Int4096
pub const fn from_limbs_le(limbs: [u128; 32]) -> Int4096
Builds directly from the limb array. The limbs are
interpreted as a little-endian two’s-complement
signed integer (i.e. the same in-memory shape
decl_wide_int! uses). Useful for the serde binary
path, which transports the raw limbs unchanged.
Sourcepub const fn limbs_le(self) -> [u128; 32]
pub const fn limbs_le(self) -> [u128; 32]
Read-only access to the underlying limbs. The
little-endian two’s-complement signed shape;
symmetric with Self::from_limbs_le.