From 1d2ae77eea6f7422ad5d0d494a864014b7c4298f Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Thu, 21 Oct 2021 08:56:30 +0200 Subject: [PATCH] Change parameters order in `CircuitBuilder::arithmetic` --- src/gadgets/arithmetic.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gadgets/arithmetic.rs b/src/gadgets/arithmetic.rs index 95e7453f..da67b131 100644 --- a/src/gadgets/arithmetic.rs +++ b/src/gadgets/arithmetic.rs @@ -27,9 +27,9 @@ impl, const D: usize> CircuitBuilder { pub fn arithmetic( &mut self, const_0: F, + const_1: F, multiplicand_0: Target, multiplicand_1: Target, - const_1: F, addend: Target, ) -> Target { let multiplicand_0_ext = self.convert_to_ext(multiplicand_0); @@ -48,13 +48,13 @@ impl, const D: usize> CircuitBuilder { /// Computes `x * y + z`. pub fn mul_add(&mut self, x: Target, y: Target, z: Target) -> Target { - self.arithmetic(F::ONE, x, y, F::ONE, z) + self.arithmetic(F::ONE, F::ONE, x, y, z) } /// Computes `x + C`. pub fn add_const(&mut self, x: Target, c: F) -> Target { let one = self.one(); - self.arithmetic(F::ONE, one, x, c, one) + self.arithmetic(F::ONE, c, one, x, one) } /// Computes `C * x`. @@ -66,19 +66,19 @@ impl, const D: usize> CircuitBuilder { /// Computes `C * x + y`. pub fn mul_const_add(&mut self, c: F, x: Target, y: Target) -> Target { let one = self.one(); - self.arithmetic(c, x, one, F::ONE, y) + self.arithmetic(c, F::ONE, x, one, y) } /// Computes `x * y - z`. pub fn mul_sub(&mut self, x: Target, y: Target, z: Target) -> Target { - self.arithmetic(F::ONE, x, y, F::NEG_ONE, z) + self.arithmetic(F::ONE, F::NEG_ONE, x, y, z) } /// Computes `x + y`. pub fn add(&mut self, x: Target, y: Target) -> Target { let one = self.one(); // x + y = 1 * x * 1 + 1 * y - self.arithmetic(F::ONE, x, one, F::ONE, y) + self.arithmetic(F::ONE, F::ONE, x, one, y) } /// Add `n` `Target`s. @@ -95,13 +95,13 @@ impl, const D: usize> CircuitBuilder { pub fn sub(&mut self, x: Target, y: Target) -> Target { let one = self.one(); // x - y = 1 * x * 1 + (-1) * y - self.arithmetic(F::ONE, x, one, F::NEG_ONE, y) + self.arithmetic(F::ONE, F::NEG_ONE, x, one, y) } /// Computes `x * y`. pub fn mul(&mut self, x: Target, y: Target) -> Target { // x * y = 1 * x * y + 0 * x - self.arithmetic(F::ONE, x, y, F::ZERO, x) + self.arithmetic(F::ONE, F::ZERO, x, y, x) } /// Multiply `n` `Target`s.