Skip to main content

Limbs

Trait Limbs 

Source
pub(super) trait Limbs:
    Sized
    + Clone
    + AsRef<[Limb]>
    + AsMut<[Limb]> {
    // Required methods
    fn widening_square(&self) -> (Self, Self);
    fn wrapping_div(num: (Self, Self), denom: &Self) -> Self;
    fn rem(num: Self, denom: &Self) -> Self;
}
Expand description

The required view over a collection of limbs to calculate the c coefficient.

Implementations MUST implement all functions in time constant to the value of the inputs, except for the amount of limbs, unless otherwise stated. Implementations MUST NOT panic for any input which the caller MAY pass.

Required Methods§

Source

fn widening_square(&self) -> (Self, Self)

Square the value, returning the (lo, hi) terms.

Implementations MUST ensure each part of the result has an amount of limbs equal to how many limbs the input has.

Source

fn wrapping_div(num: (Self, Self), denom: &Self) -> Self

Divide num by denom, returning the low bits.

Callers MUST ensure both parts of the numerator have an equivalent amount of limbs. Callers MUST NOT request a division by 0.

Implementations MUST ensure the result has an amount of limbs equal to how many limbs each part of the input has.

Source

fn rem(num: Self, denom: &Self) -> Self

Calculate the remainder of num % denom.

Callers MUST NOT specify denom = 0.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Limbs for BoxedUint

Available on crate feature alloc only.
Source§

fn widening_square(&self) -> (Self, Self)

Source§

fn wrapping_div(num: (Self, Self), denom: &Self) -> Self

Source§

fn rem(num: Self, denom: &Self) -> Self

Source§

impl<const LIMBS: usize, const WIDE_LIMBS: usize> Limbs for Uint<LIMBS>
where Self: Concat<LIMBS, Output = Uint<WIDE_LIMBS>>, Uint<WIDE_LIMBS>: SplitEven<Output = Self>,

Source§

fn widening_square(&self) -> (Self, Self)

Source§

fn wrapping_div(num: (Self, Self), denom: &Self) -> Self

Source§

fn rem(num: Self, denom: &Self) -> Self

Implementors§