ark_r1cs_std::select

Trait TwoBitLookupGadget

Source
pub trait TwoBitLookupGadget<ConstraintF: Field>: Sized {
    type TableConstant;

    // Required method
    fn two_bit_lookup(
        bits: &[Boolean<ConstraintF>],
        constants: &[Self::TableConstant],
    ) -> Result<Self, SynthesisError>;
}
Expand description

Performs a lookup in a 4-element table using two bits.

Required Associated Types§

Source

type TableConstant

The type of values being looked up.

Required Methods§

Source

fn two_bit_lookup( bits: &[Boolean<ConstraintF>], constants: &[Self::TableConstant], ) -> Result<Self, SynthesisError>

Interprets the slice bits as a two-bit integer b = bits[0] + (bits[1] << 1), and then outputs constants[b].

For example, if bits == [0, 1], and constants == [0, 1, 2, 3], this method should output a variable corresponding to 2.

§Panics

This method panics if bits.len() != 2 or constants.len() != 4.

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.

Implementors§

Source§

impl<BF, P> TwoBitLookupGadget<<P as CubicExtConfig>::BasePrimeField> for CubicExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField> + TwoBitLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>, for<'a> &'a BF: FieldOpsBounds<'a, P::BaseField, BF>, P: CubicExtVarConfig<BF>,

Source§

impl<BF, P> TwoBitLookupGadget<<P as QuadExtConfig>::BasePrimeField> for QuadExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField> + TwoBitLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>, for<'b> &'b BF: FieldOpsBounds<'b, P::BaseField, BF>, P: QuadExtVarConfig<BF>,

Source§

impl<F: PrimeField> TwoBitLookupGadget<F> for FpVar<F>

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

Source§

impl<F: PrimeField> TwoBitLookupGadget<F> for AllocatedFp<F>

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

Source§

impl<TargetF: PrimeField, BaseF: PrimeField> TwoBitLookupGadget<BaseF> for EmulatedFpVar<TargetF, BaseF>

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

Source§

type TableConstant = TargetF

Source§

impl<TargetF: PrimeField, BaseF: PrimeField> TwoBitLookupGadget<BaseF> for AllocatedEmulatedFpVar<TargetF, BaseF>

Source§

type TableConstant = TargetF