From 939acfed96b72fd485cd5713a958ed6a95107448 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Fri, 19 Nov 2021 11:14:03 +0100 Subject: [PATCH] Fix mul_many --- src/gadgets/arithmetic.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gadgets/arithmetic.rs b/src/gadgets/arithmetic.rs index 00dbbe21..d8dce53d 100644 --- a/src/gadgets/arithmetic.rs +++ b/src/gadgets/arithmetic.rs @@ -206,11 +206,11 @@ impl, const D: usize> CircuitBuilder { /// Multiply `n` `Target`s. pub fn mul_many(&mut self, terms: &[Target]) -> Target { - let terms_ext = terms - .iter() - .map(|&t| self.convert_to_ext(t)) - .collect::>(); - self.mul_many_extension(&terms_ext).to_target_array()[0] + let mut product = self.one(); + for &term in terms { + product = self.mul(product, term); + } + product } /// Exponentiate `base` to the power of `2^power_log`.