From c7fb7a510eef608a8656cacfd6ca4a65dcfd0258 Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Thu, 15 Jul 2021 13:04:53 -0400 Subject: [PATCH] Simplify types --- src/sigma/sigmaplus_prover.hpp | 4 ++-- src/sigma/sigmaplus_verifier.hpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sigma/sigmaplus_prover.hpp b/src/sigma/sigmaplus_prover.hpp index aa2837d542..645791da51 100644 --- a/src/sigma/sigmaplus_prover.hpp +++ b/src/sigma/sigmaplus_prover.hpp @@ -84,9 +84,9 @@ void SigmaPlusProver::proof( std::vector> partial_p_s; // Pre-calculate product parts and calculate p_s(x) at the same time, put the latter into p_i_sum - for (std::size_t j = m_; j > 0; j--) { + for (std::ptrdiff_t j = m_ - 1; j >= 0; j--) { partial_p_s.push_back(p_i_sum); - SigmaPrimitives::new_factor(sigma[(j - 1) * n_ + I[j - 1]], a[(j - 1) * n_ + I[j - 1]], p_i_sum); + SigmaPrimitives::new_factor(sigma[j*n_ + I[j]], a[j*n_ + I[j]], p_i_sum); } for (std::size_t j = 0; j < m_; j++) { diff --git a/src/sigma/sigmaplus_verifier.hpp b/src/sigma/sigmaplus_verifier.hpp index 5054899480..1a7030ce81 100644 --- a/src/sigma/sigmaplus_verifier.hpp +++ b/src/sigma/sigmaplus_verifier.hpp @@ -99,12 +99,12 @@ bool SigmaPlusVerifier::batch_verify( std::vector commit_scalars; // associated to commitment list h_scalars.reserve(n * m); h_scalars.resize(n * m); - for (size_t i = 0; i < n * m; i++) { + for (std::size_t i = 0; i < n * m; i++) { h_scalars[i] = Scalar(uint64_t(0)); } commit_scalars.reserve(commits.size()); commit_scalars.resize(commits.size()); - for (size_t i = 0; i < commits.size(); i++) { + for (std::size_t i = 0; i < commits.size(); i++) { commit_scalars[i] = Scalar(uint64_t(0)); } @@ -174,8 +174,8 @@ bool SigmaPlusVerifier::batch_verify( Scalar f_i(uint64_t(1)); Scalar e; - size_t size = setSizes[t]; - size_t start = commits.size() - size; + std::size_t size = setSizes[t]; + std::size_t start = commits.size() - size; std::vector::iterator ptr = commit_scalars.begin() + start; compute_batch_fis(f_i, m, f_, w3, e, ptr, ptr, ptr + size - 1); @@ -183,9 +183,9 @@ bool SigmaPlusVerifier::batch_verify( if(fPadding[t]) { Scalar pow(uint64_t(1)); std::vector f_part_product; - for (std::size_t j = m; j > 0; j--) { + for (std::ptrdiff_t j = m - 1; j >= 0; j--) { f_part_product.push_back(pow); - pow *= f_[(j - 1) * n + I_[size - 1][j - 1]]; + pow *= f_[j*n + I_[size - 1][j]]; } NthPower xj(x);