Browse Source
updated undefined behavior in accordance with zcash remedy rex4539 #4056
pull/98/head
Charles
4 years ago
No known key found for this signature in database
GPG Key ID: 251655CC546D9787
1 changed files with
3 additions and
2 deletions
-
src/arith_uint256.cpp
|
|
@ -193,9 +193,10 @@ unsigned int base_uint<BITS>::bits() const |
|
|
|
{ |
|
|
|
for (int pos = WIDTH - 1; pos >= 0; pos--) { |
|
|
|
if (pn[pos]) { |
|
|
|
for (int bits = 31; bits > 0; bits--) { |
|
|
|
if (pn[pos] & 1 << bits) |
|
|
|
for (size_t bits = 31; bits > 0; bits--) { |
|
|
|
if (pn[pos] & (1U << bits)) { |
|
|
|
return 32 * pos + bits + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
return 32 * pos + 1; |
|
|
|
} |
|
|
|