Skip to content

Commit afb2d40

Browse files
committed
update range arguments to bitmap remove_range function calls
1 parent c01bdc9 commit afb2d40

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

store/src/leaf_set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl LeafSet {
114114

115115
// First remove pos from leaf_set that were
116116
// added after the point we are rewinding to.
117-
let to_remove = ((cutoff_pos + 1) as u32)..bitmap.maximum().unwrap_or(0);
117+
let to_remove = ((cutoff_pos + 1) as u32)..=bitmap.maximum().unwrap_or(0);
118118
bitmap.remove_range(to_remove);
119119

120120
// Then add back output pos to the leaf_set
@@ -133,7 +133,7 @@ impl LeafSet {
133133
pub fn rewind(&mut self, cutoff_pos: u64, rewind_rm_pos: &Bitmap) {
134134
// First remove pos from leaf_set that were
135135
// added after the point we are rewinding to.
136-
let to_remove = ((cutoff_pos + 1) as u32)..self.bitmap.maximum().unwrap_or(0);
136+
let to_remove = ((cutoff_pos + 1) as u32)..=self.bitmap.maximum().unwrap_or(0);
137137
self.bitmap.remove_range(to_remove);
138138

139139
// Then add back output pos to the leaf_set

store/src/prune_list.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ impl PruneList {
150150
if idx == 0 {
151151
return 0;
152152
}
153-
//if min(idx as usize, self.shift_cache.len()) == 0 {
154-
println!(
155-
"idx: {}, shift_cache.len(): {}, pos0: {}",
156-
idx,
157-
self.shift_cache.len(),
158-
pos0
159-
);
160-
//}
161153
self.shift_cache[min(idx as usize, self.shift_cache.len()) - 1]
162154
}
163155

@@ -266,16 +258,12 @@ impl PruneList {
266258
}
267259

268260
// Note: We will treat this as a "closed range" below (croaring api weirdness).
269-
let cleanup_pos1 = (lc0 + 1)..size;
261+
// Note: After croaring upgrade to 1.0.2 we provide an inclusive range directly
262+
let cleanup_pos1 = (lc0 + 1)..=size;
270263

271264
// Find point where we can truncate based on bitmap "rank" (index) of pos to the left of subtree.
272265
let idx = self.bitmap.rank(lc0);
273266
self.shift_cache.truncate(idx as usize);
274-
println!(
275-
"Post truncate shift cache length: {}",
276-
self.shift_cache.len()
277-
);
278-
println!("Cleanup pos 1: {:?}", cleanup_pos1);
279267
self.leaf_shift_cache.truncate(idx as usize);
280268

281269
self.bitmap.remove_range(cleanup_pos1)

0 commit comments

Comments
 (0)