aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-08 20:25:53 +0000
committerlloyd <[email protected]>2010-06-08 20:25:53 +0000
commit4b6521f3dc6c04315a6b3525a429b2b3674a96aa (patch)
tree7a76f7ce9f95c271fc1762f9b5f5602e42dbd9af /src
parenta6bea82e65315d3e266766a5cb6c01744bbfffbb (diff)
parent558f8bc9d31725dfaa946bff4aee2db0436c56b5 (diff)
merge of '0ab1e77862bca53dec5ac1f2f9dbe994378e91f7'
and 'b9e4e0dcc98d3266c2d7e4fd631038babdfd933b'
Diffstat (limited to 'src')
-rw-r--r--src/math/bigint/bigint.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp
index 09ac2a75d..1f3255175 100644
--- a/src/math/bigint/bigint.cpp
+++ b/src/math/bigint/bigint.cpp
@@ -249,10 +249,12 @@ u32bit BigInt::bytes() const
*/
u32bit BigInt::bits() const
{
- if(sig_words() == 0)
+ const u32bit words = sig_words();
+
+ if(words == 0)
return 0;
- u32bit full_words = sig_words() - 1, top_bits = MP_WORD_BITS;
+ u32bit full_words = words - 1, top_bits = MP_WORD_BITS;
word top_word = word_at(full_words), mask = MP_WORD_TOP_BIT;
while(top_bits && ((top_word & mask) == 0))