File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,9 @@ impl<B: Borrow<[u64; BITMAP_LENGTH]>> BitmapIter<B> {
515515 } else if cmp == Ordering :: Equal {
516516 self . value_back
517517 } else {
518+ // New key is greater than original key and key_back, this iterator is now empty
519+ self . key = self . key_back ;
520+ self . value = 0 ;
518521 self . value_back = 0 ;
519522 return ;
520523 }
Original file line number Diff line number Diff line change @@ -255,3 +255,14 @@ fn advance_run_with_nth() {
255255 iter. advance_back_to ( 101779 ) ;
256256 assert_eq ! ( iter. nth( 100563 ) , None ) ;
257257}
258+
259+ #[ test]
260+ fn advance_bitset_front_and_back_past_each_other ( ) {
261+ let mut bitmap = RoaringBitmap :: new ( ) ;
262+ bitmap. insert_range ( 0 ..=0x4000 ) ;
263+ bitmap. remove_run_compression ( ) ;
264+ let mut iter = bitmap. iter ( ) ;
265+ iter. advance_back_to ( 100 ) ;
266+ iter. advance_to ( 300 ) ;
267+ assert_eq ! ( iter. next( ) , None ) ;
268+ }
You can’t perform that action at this time.
0 commit comments