Bug in roaring_bitmap_from_range followed by roaring_bitmap_add_offset
Ezibenroc opened this issue · comments
Tom Cornebize commented
The following code shows a bug:
roaring_bitmap_t *r1 = roaring_bitmap_from_range(65539, 65541, 1);
roaring_bitmap_t *r2 = roaring_bitmap_add_offset(r1, -3);
roaring_bitmap_printf(r2);
roaring_bitmap_free(r1);
roaring_bitmap_free(r2);
I was expecting to see {65536,65537}
, instead we see {0,1,2,...,65536,65537}
. It seems this bug has always been here.
Tom Cornebize commented
From my tests:
- It happens only when the bitmap is created with
roaring_bitmap_from_range
. In this case, it has a single run container. - It happens for these specific values. The bug is not present when changing the offset or changing the range.
Daniel Lemire commented
Hmmm... On my TODO. Thanks for the report.
Daniel Lemire commented
Patch release is out: https://github.com/RoaringBitmap/CRoaring/releases/tag/v1.0.1