Trait BigUintForeignFieldHelpers

Source
pub trait BigUintForeignFieldHelpers {
    // Required methods
    fn two() -> Self;
    fn two_to_limb() -> Self;
    fn two_to_2limb() -> Self;
    fn binary_modulus() -> Self;
    fn max_foreign_field_modulus<F: PrimeField>() -> Self;
    fn to_limbs(&self) -> [BigUint; 3];
    fn to_compact_limbs(&self) -> [BigUint; 2];
    fn to_field_limbs<F: Field>(&self) -> [F; 3];
    fn to_compact_field_limbs<F: Field>(&self) -> [F; 2];
    fn negate(&self) -> BigUint;
}
Expand description

Foreign field helpers

Required Methods§

Source

fn two() -> Self

2

Source

fn two_to_limb() -> Self

2^{LIMB_BITS}

Source

fn two_to_2limb() -> Self

2^{2 * LIMB_BITS}

Source

fn binary_modulus() -> Self

2^t

Source

fn max_foreign_field_modulus<F: PrimeField>() -> Self

2^259 (see foreign field multiplication RFC)

Source

fn to_limbs(&self) -> [BigUint; 3]

Convert to 3 limbs of LIMB_BITS each

Source

fn to_compact_limbs(&self) -> [BigUint; 2]

Convert to 2 limbs of 2 * LIMB_BITS each. The compressed term is the bottom part

Source

fn to_field_limbs<F: Field>(&self) -> [F; 3]

Convert to 3 PrimeField limbs of LIMB_BITS each

Source

fn to_compact_field_limbs<F: Field>(&self) -> [F; 2]

Convert to 2 PrimeField limbs of 2 * LIMB_BITS each. The compressed term is the bottom part.

Source

fn negate(&self) -> BigUint

Negate: 2^T - self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BigUintForeignFieldHelpers for BigUint

Source§

fn two() -> Self

Source§

fn two_to_limb() -> Self

Source§

fn two_to_2limb() -> Self

Source§

fn binary_modulus() -> Self

Source§

fn max_foreign_field_modulus<F: PrimeField>() -> Self

Source§

fn to_limbs(&self) -> [Self; 3]

Source§

fn to_compact_limbs(&self) -> [Self; 2]

Source§

fn to_field_limbs<F: Field>(&self) -> [F; 3]

Source§

fn to_compact_field_limbs<F: Field>(&self) -> [F; 2]

Source§

fn negate(&self) -> BigUint

Implementors§