From ce4c2977a81f94ac566750739db2d27602c9b76b Mon Sep 17 00:00:00 2001 From: raychu86 Date: Fri, 14 Aug 2020 16:10:26 -0700 Subject: [PATCH] Update signed integer pow impl --- gadgets/src/signed_integer/arithmetic/pow.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/gadgets/src/signed_integer/arithmetic/pow.rs b/gadgets/src/signed_integer/arithmetic/pow.rs index f3d13f4019..aa5b69af90 100644 --- a/gadgets/src/signed_integer/arithmetic/pow.rs +++ b/gadgets/src/signed_integer/arithmetic/pow.rs @@ -28,13 +28,6 @@ macro_rules! pow_int_impl { // let mut found_one = false; // // for i in BitIterator::new(exp) { - // if !found_one { - // if i { - // found_one = true; - // } else { - // continue; - // } - // } // // res.square_in_place(); // @@ -55,16 +48,7 @@ macro_rules! pow_int_impl { )?; for (i, bit) in other.bits.iter().rev().enumerate() { - let found_one = Boolean::constant(result.eq(&one_const)); - let cond1 = Boolean::and(cs.ns(|| format!("found_one_{}", i)), &bit.not(), &found_one)?; - let square = result.mul(cs.ns(|| format!("square_{}", i)), &result).unwrap(); - - result = Self::conditionally_select( - &mut cs.ns(|| format!("result_or_square_{}", i)), - &cond1, - &result, - &square, - )?; + result = result.mul(cs.ns(|| format!("square_{}", i)), &result).unwrap(); let mul_by_self = result .mul(cs.ns(|| format!("multiply_by_self_{}", i)), &self);