Skip to content

Commit

Permalink
use remove_range_closed for clarity (#3088)
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp authored Oct 7, 2019
1 parent 94b351b commit 39016fa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions store/src/leaf_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ impl LeafSet {

// First remove pos from leaf_set that were
// added after the point we are rewinding to.
let marker_from = cutoff_pos;
let marker_to = self.bitmap.maximum() as u64;
let rewind_add_pos: Bitmap = ((marker_from + 1)..=marker_to).map(|x| x as u32).collect();
bitmap.andnot_inplace(&rewind_add_pos);
let to_remove = ((cutoff_pos + 1) as u32)..bitmap.maximum();
bitmap.remove_range_closed(to_remove);

// Then add back output pos to the leaf_set
// that were removed.
Expand All @@ -136,10 +134,8 @@ impl LeafSet {
pub fn rewind(&mut self, cutoff_pos: u64, rewind_rm_pos: &Bitmap) {
// First remove pos from leaf_set that were
// added after the point we are rewinding to.
let marker_from = cutoff_pos;
let marker_to = self.bitmap.maximum() as u64;
let rewind_add_pos: Bitmap = ((marker_from + 1)..=marker_to).map(|x| x as u32).collect();
self.bitmap.andnot_inplace(&rewind_add_pos);
let to_remove = ((cutoff_pos + 1) as u32)..self.bitmap.maximum();
self.bitmap.remove_range_closed(to_remove);

// Then add back output pos to the leaf_set
// that were removed.
Expand Down

0 comments on commit 39016fa

Please sign in to comment.