Compare commits

...

1 Commits

Author SHA1 Message Date
lat9nq
e43191ff73 buffer_base: Avoid shift with large exponent
Undefined Behaviour Sanitizer reports a shift with an exponent larger
than 64 on a 64-bit integer (cannot recall the actual size reported.)
Use modulus to restrict it instead.
2021-04-04 18:43:47 -04:00

View File

@@ -478,7 +478,7 @@ private:
}
page += empty_bits;
const int continuous_bits = std::countr_one(word >> page);
const int continuous_bits = std::countr_one(word >> (page % 64));
if (!on_going && continuous_bits != 0) {
current_base = word_index * PAGES_PER_WORD + page;
on_going = true;