diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-10-18 11:17:05 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-10-18 11:17:05 +0200 |
commit | 96f6dc9fc50b1cc59e26d50940ebf46e1bdcc0ba (patch) | |
tree | e8e3e0f3fd409167343f3a789d5b2725f9bf9096 /src/arith_uint256.cpp | |
parent | 9c5f0d542d1db507b3b9c87bd9de6d0d758d51c1 (diff) |
Avoid triggering undefined behaviour in base_uint<BITS>::bits()
Diffstat (limited to 'src/arith_uint256.cpp')
-rw-r--r-- | src/arith_uint256.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 13fa176f8b..791dad7a60 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -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; |