diff --git a/src/tree_store/page_store/bitmap.rs b/src/tree_store/page_store/bitmap.rs index ec13ddc5..7acb9b2c 100644 --- a/src/tree_store/page_store/bitmap.rs +++ b/src/tree_store/page_store/bitmap.rs @@ -263,7 +263,7 @@ impl<'a, 'b> Iterator for U64GroupedBitmapDifference<'a, 'b> { self.data_index += 1; while self.data_index < self.data.len() { let next = self.data[self.data_index]; - let exclusion = self.exclusion_data[self.data_index]; + let exclusion = *self.exclusion_data.get(self.data_index).unwrap_or(&0); let next = next & (!exclusion); if next != 0 { self.current = next; diff --git a/src/tree_store/page_store/buddy_allocator.rs b/src/tree_store/page_store/buddy_allocator.rs index 30006786..99361d16 100644 --- a/src/tree_store/page_store/buddy_allocator.rs +++ b/src/tree_store/page_store/buddy_allocator.rs @@ -225,13 +225,14 @@ impl BuddyAllocator { result } + // Returns all allocated pages in self, for the given region, that are not allocated in `other` pub(crate) fn difference( &self, region: u32, other: &BuddyAllocator, output: &mut Vec, ) { - let num_pages = other.len(); + let num_pages = self.len(); for order in 0..=self.max_order { let other_allocated = other.get_order_allocated(order);