Fix index calculation in WasmPageAllocator

This commit is contained in:
Krzysztof Wolicki 2024-10-12 22:53:02 +02:00
parent 8a4bcc4ec3
commit 04c182274c

View File

@ -37,7 +37,7 @@ const FreeBlock = struct {
}
fn getBit(self: FreeBlock, idx: usize) PageStatus {
const bit = mem.readPackedInt(u1, mem.sliceAsBytes(self.data), 8 * idx, .little);
const bit = mem.readPackedInt(u1, mem.sliceAsBytes(self.data), idx, .little);
return @as(PageStatus, @enumFromInt(bit));
}
@ -45,7 +45,7 @@ const FreeBlock = struct {
var i: usize = 0;
const bytes = mem.sliceAsBytes(self.data);
while (i < len) : (i += 1) {
mem.writePackedInt(u1, bytes, 8 * (start_idx + i), @intFromEnum(val), .little);
mem.writePackedInt(u1, bytes, start_idx + i, @intFromEnum(val), .little);
}
}