use crate::prelude::*; use r1cs_core::{ConstraintSystem, SynthesisError}; use algebra::Field; /// If condition is `true`, return `first`; else, select `second`. pub trait CondSelectGadget where Self: Sized, { fn conditionally_select>( cs: CS, cond: &Boolean, first: &Self, second: &Self, ) -> Result; fn cost() -> usize; } /// Uses two bits to perform a lookup into a table pub trait TwoBitLookupGadget where Self: Sized, { type TableConstant; fn two_bit_lookup>( cs: CS, bits: &[Boolean], constants: &[Self::TableConstant], ) -> Result; fn cost() -> usize; }