diff options
author | Jack Lloyd <[email protected]> | 2018-12-08 06:40:05 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-08 06:40:05 -0500 |
commit | d1961721731654d39ef72bc28fe9167a850326e0 (patch) | |
tree | c92b87b36ff6d7572cc40a1e32fef034b74a762c | |
parent | 38480b96222776428d779fdecfa5b9528a65c726 (diff) |
In calc_sig_words save the size of m_reg before the loop
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index a760be4e8..73212b6b0 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -180,13 +180,14 @@ void BigInt::encode_words(word out[], size_t size) const size_t BigInt::Data::calc_sig_words() const { - size_t sig = m_reg.size(); + const size_t sz = m_reg.size(); + size_t sig = sz; word sub = 1; - for(size_t i = 0; i != m_reg.size(); ++i) + for(size_t i = 0; i != sz; ++i) { - const word w = m_reg[m_reg.size() - i - 1]; + const word w = m_reg[sz - i - 1]; sub &= CT::Mask<word>::is_zero(w).value(); sig -= sub; } |