diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-07-17 12:19:06 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-07-17 12:19:06 +0200 |
commit | a933570dea029fbb25f6b62d46b7462366ed1430 (patch) | |
tree | d0cee794b0876aac40e128e33fdc5a49e54a183c /src/basic/bitmap.c | |
parent | 22cedfe15fda59106b890ae2c646de96aa18a5eb (diff) |
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.
Diffstat (limited to 'src/basic/bitmap.c')
-rw-r--r-- | src/basic/bitmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
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]) { |