diff --git a/words.h b/words.h index 6e5dfb00..5d028bab 100644 --- a/words.h +++ b/words.h @@ -11,19 +11,40 @@ NAMESPACE_BEGIN(CryptoPP) -inline size_t CountWords(const word *X, size_t N) +/// \brief Count the number of words +/// \param x word array +/// \param n size of the word array, in elements +/// \returns number of words used in the array. +/// \details CountWords counts the number of words in a word array. +/// Leading 0-words are not included in the count. +/// \since Crypto++ 1.0 +inline size_t CountWords(const word *x, size_t n) { - while (N && X[N-1]==0) - N--; - return N; + while (n && x[n-1]==0) + n--; + return n; } +/// \brief Set the value of words +/// \param r word array +/// \param a value +/// \param n size of the word array, in elements +/// \details SetWords sets all elements in the word array to the +/// specified value. +/// \since Crypto++ 1.0 inline void SetWords(word *r, word a, size_t n) { for (size_t i=0; i