Skip to main content

NonZeroInt

Type Alias NonZeroInt 

Source
pub type NonZeroInt<const LIMBS: usize> = NonZero<Int<LIMBS>>;
Expand description

Non-zero signed integer.

Aliased Type§

pub struct NonZeroInt<const LIMBS: usize>(/* private fields */);

Implementations§

Source§

impl<const LIMBS: usize> NonZeroInt<LIMBS>

Source

pub const fn new_unwrap(n: Int<LIMBS>) -> Self

Creates a new non-zero integer in a const context.

§Panics
  • if the value is zero.
§Note

In future versions of Rust it should be possible to replace this with NonZero::new(…).unwrap()

Source

pub const fn abs_sign(&self) -> (NonZero<Uint<LIMBS>>, Choice)

The sign and magnitude of this NonZeroInt.

Source

pub const fn abs(&self) -> NonZero<Uint<LIMBS>>

The magnitude of this NonZeroInt.

Trait Implementations§

Source§

impl<const LIMBS: usize> Gcd<Int<LIMBS>> for NonZeroInt<LIMBS>

Source§

type Output = NonZero<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &Int<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &Int<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Gcd<Uint<LIMBS>> for NonZeroInt<LIMBS>

Source§

type Output = NonZero<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &Uint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &Uint<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Gcd for NonZeroInt<LIMBS>

Source§

type Output = NonZero<Uint<LIMBS>>

Output type.
Source§

fn gcd(&self, rhs: &NonZeroInt<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime(&self, rhs: &NonZeroInt<LIMBS>) -> Self::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl<const LIMBS: usize> Xgcd for NonZeroInt<LIMBS>

Source§

type Output = XgcdOutput<LIMBS, NonZero<Uint<LIMBS>>>

Output type.
Source§

fn xgcd(&self, rhs: &NonZeroInt<LIMBS>) -> Self::Output

Compute the extended greatest common divisor of self and rhs.
Source§

fn xgcd_vartime(&self, rhs: &NonZeroInt<LIMBS>) -> Self::Output

Compute the extended greatest common divisor of self and rhs in variable time.