updated undefined behavior in accordance with zcash remedy rex4539 #4056
This commit is contained in:
@@ -193,9 +193,10 @@ unsigned int base_uint<BITS>::bits() const
|
|||||||
{
|
{
|
||||||
for (int pos = WIDTH - 1; pos >= 0; pos--) {
|
for (int pos = WIDTH - 1; pos >= 0; pos--) {
|
||||||
if (pn[pos]) {
|
if (pn[pos]) {
|
||||||
for (int bits = 31; bits > 0; bits--) {
|
for (size_t bits = 31; bits > 0; bits--) {
|
||||||
if (pn[pos] & 1 << bits)
|
if (pn[pos] & (1U << bits)) {
|
||||||
return 32 * pos + bits + 1;
|
return 32 * pos + bits + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 32 * pos + 1;
|
return 32 * pos + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user