From 36a1386c6f198912e5946f9016d6cc359d98c3f9 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Fri, 30 Jul 2021 12:00:24 -0700 Subject: [PATCH] Small fix in arithmetic_extension_special_cases (#140) This is detecting the case where we multiply something by 1 and add 0. In that case we can just return the thing being multiplied by 1. We were using the wrong constant to detect this. Reduces the cost of `compute_evaluation` from 8 to 6 gates. --- src/gadgets/arithmetic_extension.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gadgets/arithmetic_extension.rs b/src/gadgets/arithmetic_extension.rs index e274b781..c1bedb9d 100644 --- a/src/gadgets/arithmetic_extension.rs +++ b/src/gadgets/arithmetic_extension.rs @@ -143,7 +143,7 @@ impl, const D: usize> CircuitBuilder { } } if let Some(x) = mul_1_const { - if (x * const_1.into()).is_one() { + if (x * const_0.into()).is_one() { return Some(multiplicand_0); } }