Skip to content

Commit

Permalink
Fix BuddyAllocator::difference
Browse files Browse the repository at this point in the history
This did not lead to a bug because we only use this in situations where
both the old and new region are the same length
  • Loading branch information
cberner committed Dec 26, 2024
1 parent efb761c commit b27a9df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tree_store/page_store/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/tree_store/page_store/buddy_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PageNumber>,
) {
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);
Expand Down

0 comments on commit b27a9df

Please sign in to comment.