Remove unnecessary special case in BuddyAllocator.free

This commit is contained in:
sergeypdev 2024-07-20 17:53:11 +04:00
parent 2c385c7656
commit a39fdad1a0

View File

@ -87,10 +87,6 @@ pub fn alloc(self: *BuddyAllocator, size: usize) !Alloc {
}
pub fn free(self: *BuddyAllocator, allocation: Alloc) void {
if (allocation.depth == 0) {
std.debug.assert(self.states[0] == BlockState.Allocated);
self.states[0] = BlockState.Free;
} else {
const size = self.getDepthSize(@intCast(allocation.depth));
const depth_offset = (@as(usize, @intCast(1)) << allocation.depth) - 1;
@ -111,7 +107,6 @@ pub fn free(self: *BuddyAllocator, allocation: Alloc) void {
}
}
}
}
const SearchContext = struct {
sort_key: usize = std.math.maxInt(usize),