updated undefined behavior in accordance with zcash remedy rex4539 #4056

This commit is contained in:
Charles
2020-03-29 03:01:46 -04:00
parent 2e51538df8
commit 54ec0d0994

View File

@@ -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;
}