use crate::prelude::*; use algebra::Field; use r1cs_core::SynthesisError; /// If condition is `true`, return `true_value`; else, select `false_value`. pub trait CondSelectGadget where Self: Sized, { fn conditionally_select( cond: &Boolean, true_value: &Self, false_value: &Self, ) -> Result; } /// Uses two bits to perform a lookup into a table pub trait TwoBitLookupGadget where Self: Sized, { type TableConstant; fn two_bit_lookup( bits: &[Boolean], constants: &[Self::TableConstant], ) -> Result; } /// Uses three bits to perform a lookup into a table, where the last bit /// performs negation pub trait ThreeBitCondNegLookupGadget where Self: Sized, { type TableConstant; fn three_bit_cond_neg_lookup( bits: &[Boolean], b0b1: &Boolean, constants: &[Self::TableConstant], ) -> Result; }