update range arguments to bitmap remove_range function calls

This commit is contained in:
Yeastplume 2024-02-06 14:14:42 +00:00
parent c01bdc9443
commit afb2d40dfd
2 changed files with 4 additions and 16 deletions

View file

@ -114,7 +114,7 @@ impl LeafSet {
// First remove pos from leaf_set that were
// added after the point we are rewinding to.
let to_remove = ((cutoff_pos + 1) as u32)..bitmap.maximum().unwrap_or(0);
let to_remove = ((cutoff_pos + 1) as u32)..=bitmap.maximum().unwrap_or(0);
bitmap.remove_range(to_remove);
// Then add back output pos to the leaf_set
@ -133,7 +133,7 @@ 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 to_remove = ((cutoff_pos + 1) as u32)..self.bitmap.maximum().unwrap_or(0);
let to_remove = ((cutoff_pos + 1) as u32)..=self.bitmap.maximum().unwrap_or(0);
self.bitmap.remove_range(to_remove);
// Then add back output pos to the leaf_set

View file

@ -150,14 +150,6 @@ impl PruneList {
if idx == 0 {
return 0;
}
//if min(idx as usize, self.shift_cache.len()) == 0 {
println!(
"idx: {}, shift_cache.len(): {}, pos0: {}",
idx,
self.shift_cache.len(),
pos0
);
//}
self.shift_cache[min(idx as usize, self.shift_cache.len()) - 1]
}
@ -266,16 +258,12 @@ impl PruneList {
}
// Note: We will treat this as a "closed range" below (croaring api weirdness).
let cleanup_pos1 = (lc0 + 1)..size;
// Note: After croaring upgrade to 1.0.2 we provide an inclusive range directly
let cleanup_pos1 = (lc0 + 1)..=size;
// Find point where we can truncate based on bitmap "rank" (index) of pos to the left of subtree.
let idx = self.bitmap.rank(lc0);
self.shift_cache.truncate(idx as usize);
println!(
"Post truncate shift cache length: {}",
self.shift_cache.len()
);
println!("Cleanup pos 1: {:?}", cleanup_pos1);
self.leaf_shift_cache.truncate(idx as usize);
self.bitmap.remove_range(cleanup_pos1)