pub trait Integer: 'static + Add<Output = Self> + for<'a> Add<&'a Self, Output = Self> + AddMod<Output = Self> + AsRef<[Limb]> + BitAnd<Output = Self> + for<'a> BitAnd<&'a Self, Output = Self> + BitAndAssign + for<'a> BitAndAssign<&'a Self> + BitOr<Output = Self> + for<'a> BitOr<&'a Self, Output = Self> + BitOrAssign + for<'a> BitOrAssign<&'a Self> + BitXor<Output = Self> + for<'a> BitXor<&'a Self, Output = Self> + BitXorAssign + for<'a> BitXorAssign<&'a Self> + BitOps + CheckedAdd + CheckedSub + CheckedMul + CheckedDiv + Clone + ConstantTimeEq + ConstantTimeGreater + ConstantTimeLess + ConstantTimeSelect + Debug + Default + Div<NonZero<Self>, Output = Self> + for<'a> Div<&'a NonZero<Self>, Output = Self> + DivAssign<NonZero<Self>> + for<'a> DivAssign<&'a NonZero<Self>> + DivRemLimb + Eq + From<u8> + From<u16> + From<u32> + From<u64> + From<Limb> + Mul<Output = Self> + for<'a> Mul<&'a Self, Output = Self> + MulMod<Output = Self> + NegMod<Output = Self> + Not<Output = Self> + Ord + Rem<NonZero<Self>, Output = Self> + for<'a> Rem<&'a NonZero<Self>, Output = Self> + RemLimb + Send + Sized + Shl<u32, Output = Self> + ShlAssign<u32> + ShlVartime + Shr<u32, Output = Self> + ShrAssign<u32> + ShrVartime + Sub<Output = Self> + for<'a> Sub<&'a Self, Output = Self> + SubMod<Output = Self> + Sync + SquareRoot + WrappingAdd + WrappingSub + WrappingMul + WrappingNeg + WrappingShl + WrappingShr + Zero {
    type Monty: Monty<Integer = Self>;

    // Required methods
    fn one() -> Self;
    fn from_limb_like(limb: Limb, other: &Self) -> Self;
    fn nlimbs(&self) -> usize;

    // Provided methods
    fn one_like(other: &Self) -> Self { ... }
    fn is_odd(&self) -> Choice { ... }
    fn is_even(&self) -> Choice { ... }
}
Expand description

Integer trait: represents common functionality of integer types provided by this crate.

Required Associated Types§

source

type Monty: Monty<Integer = Self>

The corresponding Montgomery representation, optimized for the performance of modular operations at the price of a conversion overhead.

Required Methods§

source

fn one() -> Self

The value 1.

source

fn from_limb_like(limb: Limb, other: &Self) -> Self

Returns an integer with the first limb set to limb, and the same precision as other.

source

fn nlimbs(&self) -> usize

Number of limbs in this integer.

Provided Methods§

source

fn one_like(other: &Self) -> Self

The value 1 with the same precision as other.

source

fn is_odd(&self) -> Choice

Is this integer value an odd number?

Returns

If odd, returns Choice(1). Otherwise, returns Choice(0).

source

fn is_even(&self) -> Choice

Is this integer value an even number?

Returns

If even, returns Choice(1). Otherwise, returns Choice(0).

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Integer for BoxedUint

Available on crate feature alloc only.
source§

impl<const LIMBS: usize> Integer for Uint<LIMBS>

§

type Monty = MontyForm<LIMBS>