pub trait TwoBitLookupGadget<ConstraintF: Field>where
    Self: Sized,
{ type TableConstant; 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§

The type of values being looked up.

Required Methods§

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.

Implementors§

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

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

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