pub type NonZeroUint<const LIMBS: usize> = NonZero<Uint<LIMBS>>;Expand description
Non-zero unsigned integer.
Aliased Type§
#[repr(transparent)]pub struct NonZeroUint<const LIMBS: usize>(pub(crate) Uint<LIMBS>);Tuple Fields§
§0: Uint<LIMBS>Implementations§
Source§impl<const LIMBS: usize> NonZeroUint<LIMBS>
impl<const LIMBS: usize> NonZeroUint<LIMBS>
Sourcepub const fn new_unwrap(n: Uint<LIMBS>) -> Self
pub const fn new_unwrap(n: Uint<LIMBS>) -> Self
Creates a new non-zero integer in a const context.
In future versions of Rust it should be possible to replace this with
NonZero::new(…).unwrap()
§Panics
- if the value is zero.
Sourcepub const fn from_be_hex(hex: &str) -> Self
pub const fn from_be_hex(hex: &str) -> Self
Create a new NonZero<Uint> from the provided big endian hex string.
§Panics
- if the hex is zero, malformed, or not zero-padded accordingly for the size.
Sourcepub const fn from_le_hex(hex: &str) -> Self
pub const fn from_le_hex(hex: &str) -> Self
Create a new NonZero<Uint> from the provided little endian hex string.
§Panics
- if the hex is zero, malformed, or not zero-padded accordingly for the size.
Sourcepub const fn from_u8(n: NonZeroU8) -> Self
pub const fn from_u8(n: NonZeroU8) -> Self
Create a NonZeroUint from a NonZeroU8 (const-friendly)
Sourcepub const fn from_u16(n: NonZeroU16) -> Self
pub const fn from_u16(n: NonZeroU16) -> Self
Create a NonZeroUint from a NonZeroU16 (const-friendly)
Sourcepub const fn from_u32(n: NonZeroU32) -> Self
pub const fn from_u32(n: NonZeroU32) -> Self
Create a NonZeroUint from a NonZeroU32 (const-friendly)
Sourcepub const fn from_u64(n: NonZeroU64) -> Self
pub const fn from_u64(n: NonZeroU64) -> Self
Create a NonZeroUint from a NonZeroU64 (const-friendly)
Sourcepub const fn from_u128(n: NonZeroU128) -> Self
pub const fn from_u128(n: NonZeroU128) -> Self
Create a NonZeroUint from a NonZeroU128 (const-friendly)
Sourcepub const fn as_uint_ref(&self) -> &NonZeroUintRef
pub const fn as_uint_ref(&self) -> &NonZeroUintRef
Borrow this NonZero<Uint> as a &NonZeroUintRef.
Source§impl<const LIMBS: usize> NonZeroUint<LIMBS>
impl<const LIMBS: usize> NonZeroUint<LIMBS>
Sourcepub const fn gcd_unsigned(&self, rhs: &Uint<LIMBS>) -> Self
pub const fn gcd_unsigned(&self, rhs: &Uint<LIMBS>) -> Self
Compute the greatest common divisor of self and rhs.
Sourcepub const fn gcd_unsigned_vartime(&self, rhs: &Uint<LIMBS>) -> Self
pub const fn gcd_unsigned_vartime(&self, rhs: &Uint<LIMBS>) -> Self
Compute the greatest common divisor of self and rhs.
Executes in variable time w.r.t. all input parameters.
Sourcepub const fn xgcd(&self, rhs: &Self) -> XgcdOutput<LIMBS, NonZeroUint<LIMBS>>
pub const fn xgcd(&self, rhs: &Self) -> XgcdOutput<LIMBS, NonZeroUint<LIMBS>>
Execute the Extended GCD algorithm.
Given (self, rhs), computes (g, x, y) s.t. self * x + rhs * y = g = gcd(self, rhs).
Trait Implementations§
Source§impl<const LIMBS: usize> AsRef<NonZero<UintRef>> for NonZeroUint<LIMBS>
impl<const LIMBS: usize> AsRef<NonZero<UintRef>> for NonZeroUint<LIMBS>
Source§fn as_ref(&self) -> &NonZeroUintRef
fn as_ref(&self) -> &NonZeroUintRef
Source§impl<const LIMBS: usize> Gcd for NonZeroUint<LIMBS>
impl<const LIMBS: usize> Gcd for NonZeroUint<LIMBS>
Source§fn gcd(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
fn gcd(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
self and rhs.Source§fn gcd_vartime(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
fn gcd_vartime(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
self and rhs in variable time.Source§impl<const LIMBS: usize> Xgcd for NonZeroUint<LIMBS>
impl<const LIMBS: usize> Xgcd for NonZeroUint<LIMBS>
Source§fn xgcd(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
fn xgcd(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
self and rhs.Source§fn xgcd_vartime(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
fn xgcd_vartime(&self, rhs: &NonZeroUint<LIMBS>) -> Self::Output
self and rhs in variable time.