From 04c182274c82d19f096ce04d71f89f28d2ae686c Mon Sep 17 00:00:00 2001 From: Krzysztof Wolicki Date: Sat, 12 Oct 2024 22:53:02 +0200 Subject: [PATCH] Fix index calculation in WasmPageAllocator --- lib/std/heap/WasmPageAllocator.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/heap/WasmPageAllocator.zig b/lib/std/heap/WasmPageAllocator.zig index 461b0f9fc5..ca625e43ed 100644 --- a/lib/std/heap/WasmPageAllocator.zig +++ b/lib/std/heap/WasmPageAllocator.zig @@ -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); } }