File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -731,6 +731,8 @@ impl<I: SliceIterator<Interval>> RunIter<I> {
731731 if index == self . intervals . as_slice ( ) . len ( ) {
732732 // Consume the whole iterator
733733 self . intervals . nth ( index) ;
734+ self . forward_offset = 0 ;
735+ self . backward_offset = 0 ;
734736 return ;
735737 }
736738 if let Some ( value) = index. checked_sub ( 1 ) {
@@ -779,6 +781,8 @@ impl<I: SliceIterator<Interval>> RunIter<I> {
779781 if index == 0 {
780782 // Consume the whole iterator
781783 self . intervals . nth_back ( self . intervals . as_slice ( ) . len ( ) ) ;
784+ self . forward_offset = 0 ;
785+ self . backward_offset = 0 ;
782786 return ;
783787 }
784788 let backward_index = self . intervals . as_slice ( ) . len ( ) - index;
Original file line number Diff line number Diff line change @@ -247,6 +247,17 @@ fn advance_run_front_and_back_past_each_other() {
247247 assert_eq ! ( iter. next( ) , None ) ;
248248}
249249
250+ #[ test]
251+ fn advance_run_both_sides_past_each_other ( ) {
252+ let mut bitmap = RoaringBitmap :: new ( ) ;
253+ bitmap. insert_range ( 0 ..0x1000 ) ;
254+ let mut iter = bitmap. iter ( ) ;
255+ iter. advance_back_to ( 100 ) ;
256+ iter. advance_to ( 0xFFFF ) ;
257+ assert_eq ! ( iter. len( ) , 0 ) ;
258+ assert_eq ! ( iter. nth_back( 0 ) , None ) ;
259+ }
260+
250261#[ test]
251262fn advance_run_with_nth ( ) {
252263 let mut bitmap = RoaringBitmap :: new ( ) ;
You can’t perform that action at this time.
0 commit comments