bitmap: avoid 32bit integer overflow in shift
We really must use 64bit integers to calculate long-long shifts. Otherwise, we will never get higher masks than 2^31.
This commit is contained in:
+1
-1
@@ -157,7 +157,7 @@ bool bitmap_iterate(Bitmap *b, Iterator *i, unsigned *n) {
|
||||
|
||||
offset = BITMAP_NUM_TO_OFFSET(i->idx);
|
||||
rem = BITMAP_NUM_TO_REM(i->idx);
|
||||
bitmask = 1 << rem;
|
||||
bitmask = 1ULL << rem;
|
||||
|
||||
for (; offset < b->n_bitmaps; offset ++) {
|
||||
if (b->bitmaps[offset]) {
|
||||
|
||||
Reference in New Issue
Block a user