From 39016faf528234d9ce956d4d610c6622faadb75f Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Mon, 7 Oct 2019 21:01:44 +0100 Subject: [PATCH] use remove_range_closed for clarity (#3088) --- store/src/leaf_set.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/store/src/leaf_set.rs b/store/src/leaf_set.rs index be4af653a..05143c464 100644 --- a/store/src/leaf_set.rs +++ b/store/src/leaf_set.rs @@ -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. @@ -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.