Skip to main content

LimbHelpers

Trait LimbHelpers 

Source
trait LimbHelpers:
    Sized
    + AsRef<[Limb]>
    + AsMut<[Limb]> {
    // Provided methods
    fn double(self) -> Self { ... }
    fn ct_neg_mod(self, modulus: &Self, negate: Choice) -> (Choice, Self) { ... }
    fn sub_mod(self, b: &Self, modulus: &Self) -> Self { ... }
}

Provided Methods§

Source

fn double(self) -> Self

Double the input.

This assumes the result will fit within the same amount of limbs.

Source

fn ct_neg_mod(self, modulus: &Self, negate: Choice) -> (Choice, Self)

Negate self modulo modulus if negate == true.

This assumes self and modulus have the same amount of limbs and that self <= modulus. This will return if the input was 0 (as an integer, not as congruent to) and the value. The value may be the modulus (as congruent to 0) but only if the input was 0 and negate was true.

Source

fn sub_mod(self, b: &Self, modulus: &Self) -> Self

Subtract b from self modulo modulus.

This assumes self, b, and modulus have the same amount of limbs and both self and b are less than or equal to the modulus, and may return the modulus to represent 0 when asked to calculate modulus - 0.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: Sized + AsRef<[Limb]> + AsMut<[Limb]>> LimbHelpers for T