From 6cc702469cb7410523c55116daba07474d33c565 Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Sun, 22 Oct 2023 10:54:25 -0500 Subject: [PATCH] Verifier simplification --- src/range_proof.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/range_proof.rs b/src/range_proof.rs index a34f78b..8e9ce14 100644 --- a/src/range_proof.rs +++ b/src/range_proof.rs @@ -848,11 +848,9 @@ where // Compute d's sum efficiently let mut d_sum = z_square; let mut d_sum_temp_z = z_square; - let mut d_sum_temp_2m = aggregation_factor.checked_mul(2).ok_or(ProofError::SizeOverflow)?; - while d_sum_temp_2m > 2 { + for _ in 0..aggregation_factor.ilog2() { d_sum = d_sum + d_sum * d_sum_temp_z; d_sum_temp_z = d_sum_temp_z * d_sum_temp_z; - d_sum_temp_2m /= 2; // Rounds towards zero, truncating any fractional part } d_sum *= two_n_minus_one;