mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-05-28 20:59:26 +00:00
Merge branch 'main' of github.com:mir-protocol/plonky2 into non-inv
This commit is contained in:
commit
053a0206f1
@ -337,6 +337,12 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
BoolTarget::new_unsafe(self.mul(b1.target, b2.target))
|
BoolTarget::new_unsafe(self.mul(b1.target, b2.target))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// computes the arithmetic extension of logical "or": `b1 + b2 - b1 * b2`
|
||||||
|
pub fn or(&mut self, b1: BoolTarget, b2: BoolTarget) -> BoolTarget {
|
||||||
|
let res_minus_b2 = self.arithmetic(-F::ONE, F::ONE, b1.target, b2.target, b1.target);
|
||||||
|
BoolTarget::new_unsafe(self.add(res_minus_b2, b2.target))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn _if(&mut self, b: BoolTarget, x: Target, y: Target) -> Target {
|
pub fn _if(&mut self, b: BoolTarget, x: Target, y: Target) -> Target {
|
||||||
let not_b = self.not(b);
|
let not_b = self.not(b);
|
||||||
let maybe_x = self.mul(b.target, x);
|
let maybe_x = self.mul(b.target, x);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user