Fix ns issue
Pratyush Mishra pratyushmishra@berkeley.edu
Fri, 28 Feb 2020 17:30:46 -0800
1 files changed,
3 insertions(+),
6 deletions(-)
jump to
M
r1cs-std/src/fields/mod.rs
→
r1cs-std/src/fields/mod.rs
@@ -232,15 +232,12 @@ ) -> Result<Self, SynthesisError> {
let mut res = Self::one(cs.ns(|| "Alloc result"))?; let mut found_one = false; - for i in BitIterator::new(exp) - { - if found_one - { + for (i, bit) in BitIterator::new(exp).enumerate() { + if found_one { res.square_in_place(cs.ns(|| format!("square for bit {:?}", i)))?; } - if !i - { + if !bit { found_one = true; res.mul_in_place(cs.ns(|| format!("mul for bit {:?}", i)), self)?; }