Trait snarkvm_wasm::prelude::TwoBitLookupGadget[][src]

pub trait TwoBitLookupGadget<F> where
    F: Field
{ type TableConstant; fn two_bit_lookup<CS>(
        cs: CS,
        bits: &[Boolean],
        constants: &[Self::TableConstant]
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
fn cost() -> usize; }
Expand description

Uses two bits to perform a lookup into a table

Associated Types

Required methods

fn two_bit_lookup<CS>(
    cs: CS,
    bits: &[Boolean],
    constants: &[Self::TableConstant]
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

fn cost() -> usize[src]

Implementors

impl<F> TwoBitLookupGadget<F> for FpGadget<F> where
    F: PrimeField
[src]

Uses two bits to perform a lookup into a table b is little-endian: b[0] is LSB.

type TableConstant = F

pub fn two_bit_lookup<CS>(
    cs: CS,
    b: &[Boolean],
    c: &[<FpGadget<F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<FpGadget<F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost() -> usize[src]

impl<F> TwoBitLookupGadget<F> for AllocatedFp<F> where
    F: PrimeField
[src]

Uses two bits to perform a lookup into a table b is little-endian: b[0] is LSB.

type TableConstant = F

pub fn two_bit_lookup<CS>(
    cs: CS,
    b: &[Boolean],
    c: &[<AllocatedFp<F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<AllocatedFp<F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost() -> usize[src]

impl<P, F> TwoBitLookupGadget<F> for Fp2Gadget<P, F> where
    P: Fp2Parameters<Fp = F>,
    F: PrimeField
[src]

type TableConstant = Fp2<P>

pub fn two_bit_lookup<CS>(
    cs: CS,
    b: &[Boolean],
    c: &[<Fp2Gadget<P, F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<Fp2Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost() -> usize[src]

impl<P, F> TwoBitLookupGadget<F> for Fp6Gadget<P, F> where
    P: Fp6Parameters,
    F: PrimeField,
    <P as Fp6Parameters>::Fp2Params: Fp2Parameters,
    <<P as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F, 
[src]

type TableConstant = Fp6<P>

pub fn two_bit_lookup<CS>(
    cs: CS,
    b: &[Boolean],
    c: &[<Fp6Gadget<P, F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<Fp6Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost() -> usize[src]

impl<P, F> TwoBitLookupGadget<F> for Fp12Gadget<P, F> where
    P: Fp12Parameters,
    F: PrimeField,
    <<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params: Fp2Parameters,
    <<<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F, 
[src]

type TableConstant = Fp12<P>

pub fn two_bit_lookup<CS>(
    cs: CS,
    b: &[Boolean],
    c: &[<Fp12Gadget<P, F> as TwoBitLookupGadget<F>>::TableConstant]
) -> Result<Fp12Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost() -> usize[src]

impl<TargetField, BaseField> TwoBitLookupGadget<BaseField> for NonNativeFieldVar<TargetField, BaseField> where
    BaseField: PrimeField,
    TargetField: PrimeField
[src]

Uses two bits to perform a lookup into a table b is little-endian: b[0] is LSB.

type TableConstant = TargetField

pub fn two_bit_lookup<CS>(
    cs: CS,
    bits: &[Boolean],
    constants: &[<NonNativeFieldVar<TargetField, BaseField> as TwoBitLookupGadget<BaseField>>::TableConstant]
) -> Result<NonNativeFieldVar<TargetField, BaseField>, SynthesisError> where
    CS: ConstraintSystem<BaseField>, 
[src]

pub fn cost() -> usize[src]

impl<TargetField, BaseField> TwoBitLookupGadget<BaseField> for AllocatedNonNativeFieldVar<TargetField, BaseField> where
    BaseField: PrimeField,
    TargetField: PrimeField
[src]

type TableConstant = TargetField

pub fn two_bit_lookup<CS>(
    cs: CS,
    bits: &[Boolean],
    constants: &[<AllocatedNonNativeFieldVar<TargetField, BaseField> as TwoBitLookupGadget<BaseField>>::TableConstant]
) -> Result<AllocatedNonNativeFieldVar<TargetField, BaseField>, SynthesisError> where
    CS: ConstraintSystem<BaseField>, 
[src]

pub fn cost() -> usize[src]