diff options
author | Jeffrey Walton <noloader@gmail.com> | 2015-07-13 21:40:42 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2015-07-13 21:40:42 -0400 |
commit | e78b8fe1dff7acdb1a52f12de72f34dc33982901 (patch) | |
tree | b04058dd954e5830f546423e0e869eb45577163d /algebra.cpp | |
parent | b5ed163c87f0ef017058154820d710fb3780d8ec (diff) | |
download | cryptopp-git-e78b8fe1dff7acdb1a52f12de72f34dc33982901.tar.gz |
Cleared warnings on WindowSlider struct
Diffstat (limited to 'algebra.cpp')
-rw-r--r-- | algebra.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/algebra.cpp b/algebra.cpp index 958e6370..0475e7e9 100644 --- a/algebra.cpp +++ b/algebra.cpp @@ -206,49 +206,50 @@ template <class Element, class Iterator> Element GeneralCascadeMultiplication(co struct WindowSlider { WindowSlider(const Integer &expIn, bool fastNegate, unsigned int windowSizeIn=0) - : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) + : m_exp(expIn), m_windowModulus(Integer::One()), m_windowSize(windowSizeIn), m_windowBegin(0), m_fastNegate(fastNegate), m_firstTime(true), m_finished(false) { - if (windowSize == 0) + if (m_windowSize == 0) { - unsigned int expLen = exp.BitCount(); - windowSize = expLen <= 17 ? 1 : (expLen <= 24 ? 2 : (expLen <= 70 ? 3 : (expLen <= 197 ? 4 : (expLen <= 539 ? 5 : (expLen <= 1434 ? 6 : 7))))); + const unsigned int expLen = m_exp.BitCount(); + m_windowSize = expLen <= 17 ? 1 : (expLen <= 24 ? 2 : (expLen <= 70 ? 3 : (expLen <= 197 ? 4 : (expLen <= 539 ? 5 : (expLen <= 1434 ? 6 : 7))))); } - windowModulus <<= windowSize; + m_windowModulus <<= m_windowSize; } void FindNextWindow() { - unsigned int expLen = exp.WordCount() * WORD_BITS; - unsigned int skipCount = firstTime ? 0 : windowSize; - firstTime = false; - while (!exp.GetBit(skipCount)) + const unsigned int expLen = m_exp.WordCount() * WORD_BITS; + unsigned int skipCount = m_firstTime ? 0 : m_windowSize; + m_firstTime = false; + + while (!m_exp.GetBit(skipCount)) { if (skipCount >= expLen) { - finished = true; + m_finished = true; return; } skipCount++; } - exp >>= skipCount; - windowBegin += skipCount; - expWindow = word32(exp % (word(1) << windowSize)); + m_exp >>= skipCount; + m_windowBegin += skipCount; + m_expWindow = word32(m_exp % (word(1) << m_windowSize)); - if (fastNegate && exp.GetBit(windowSize)) + if (m_fastNegate && m_exp.GetBit(m_windowSize)) { - negateNext = true; - expWindow = (word32(1) << windowSize) - expWindow; - exp += windowModulus; + m_negateNext = true; + m_expWindow = (word32(1) << m_windowSize) - m_expWindow; + m_exp += m_windowModulus; } else - negateNext = false; + m_negateNext = false; } - Integer exp, windowModulus; - unsigned int windowSize, windowBegin; - word32 expWindow; - bool fastNegate, negateNext, firstTime, finished; + Integer m_exp, m_windowModulus; + unsigned int m_windowSize, m_windowBegin; + word32 m_expWindow; + bool m_fastNegate, m_negateNext, m_firstTime, m_finished; }; template <class T> @@ -264,7 +265,7 @@ void AbstractGroup<T>::SimultaneousMultiply(T *results, const T &base, const Int assert(expBegin->NotNegative()); exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0)); exponents[i].FindNextWindow(); - buckets[i].resize(1<<(exponents[i].windowSize-1), Identity()); + buckets[i].resize(1<<(exponents[i].m_windowSize-1), Identity()); } unsigned int expBitPosition = 0; @@ -276,16 +277,16 @@ void AbstractGroup<T>::SimultaneousMultiply(T *results, const T &base, const Int notDone = false; for (i=0; i<expCount; i++) { - if (!exponents[i].finished && expBitPosition == exponents[i].windowBegin) + if (!exponents[i].m_finished && expBitPosition == exponents[i].m_windowBegin) { - Element &bucket = buckets[i][exponents[i].expWindow/2]; - if (exponents[i].negateNext) + Element &bucket = buckets[i][exponents[i].m_expWindow/2]; + if (exponents[i].m_negateNext) Accumulate(bucket, Inverse(g)); else Accumulate(bucket, g); exponents[i].FindNextWindow(); } - notDone = notDone || !exponents[i].finished; + notDone = notDone || !exponents[i].m_finished; } if (notDone) |