Skip to content

Commit 96f6dc9

Browse files
Avoid triggering undefined behaviour in base_uint<BITS>::bits()
1 parent 9c5f0d5 commit 96f6dc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/arith_uint256.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ unsigned int base_uint<BITS>::bits() const
176176
for (int pos = WIDTH - 1; pos >= 0; pos--) {
177177
if (pn[pos]) {
178178
for (int nbits = 31; nbits > 0; nbits--) {
179-
if (pn[pos] & 1 << nbits)
179+
if (pn[pos] & 1U << nbits)
180180
return 32 * pos + nbits + 1;
181181
}
182182
return 32 * pos + 1;

0 commit comments

Comments
 (0)