From a933570dea029fbb25f6b62d46b7462366ed1430 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 17 Jul 2015 12:19:06 +0200 Subject: 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. --- src/basic/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c index 83448ca93c..c5039fd22f 100644 --- a/src/basic/bitmap.c +++ b/src/basic/bitmap.c @@ -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]) { -- cgit v1.2.3-54-g00ecf