Merge pull request #98 from csharpee/bugsbunny

updated undefined behavior in accordance with zcash remedy rex4539 #4056
This commit is contained in:
Duke Leto
2020-04-16 08:43:46 -04:00
committed by GitHub

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