tower120 / hi_sparse_bitset

Hierarchical sparse bitset
37 stars 1 forks source link

Incorrect `is_empty` result after intersection #33

Closed 3Hren closed 1 week ago

3Hren commented 2 weeks ago

Hi! First or all, thanks for this magnificiant library!

I have the following code:

let mut bm0: BitSet<_64bit> = BitSet::new();
bm0.insert(0);
bm0.insert(1);
bm0.insert(512);
bm0.insert(800);

let mut bm1: BitSet<_64bit> = BitSet::new();
bm1.insert(1);
bm1.insert(2);
bm1.insert(511);
bm1.insert(513);
bm1.insert(800);

let intersection = &bm0 & &bm1;
dbg!(&intersection);
assert!(!intersection.is_empty());

, which fails in assertion, while the dbg macro shows that the intersected bitset is not empty.

Am I doing something wrong?

tower120 commented 2 weeks ago

There is an error in !TRUSTED_HIERARCHY's is_empty() implementation. I'll fix that soon.

Thank you for bug report.

tower120 commented 1 week ago

Can you try this branch https://github.com/tower120/hi_sparse_bitset/tree/incorrect_is_empty_fix ?

tower120 commented 1 week ago

fixed in 0.6.1

3Hren commented 1 week ago

Can you try this branch https://github.com/tower120/hi_sparse_bitset/tree/incorrect_is_empty_fix ?

Now everything works. Thank you!