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:
David Herrmann
2015-07-17 12:19:06 +02:00
parent 22cedfe15f
commit a933570dea
+1 -1
View File
@@ -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]) {