Skip to content

Commit

Permalink
Avoid triggering undefined behaviour in base_uint<BITS>::bits()
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift committed Oct 18, 2018
1 parent 9c5f0d5 commit 96f6dc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/arith_uint256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ unsigned int base_uint<BITS>::bits() const
for (int pos = WIDTH - 1; pos >= 0; pos--) {
if (pn[pos]) {
for (int nbits = 31; nbits > 0; nbits--) {
if (pn[pos] & 1 << nbits)
if (pn[pos] & 1U << nbits)
return 32 * pos + nbits + 1;
}
return 32 * pos + 1;
Expand Down

0 comments on commit 96f6dc9

Please sign in to comment.