zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 04c182274c82d19f096ce04d71f89f28d2ae686c (tree)
parent 8a4bcc4ec3dfc8bb8ff43eaece43bacb60a36a91
Author: Krzysztof Wolicki <der.teufel.mail@gmail.com>
Date:   Sat, 12 Oct 2024 22:53:02 +0200

Fix index calculation in WasmPageAllocator

Diffstat:
Mlib/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 @@ -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); } }