commit b23662feeb0ecea67eefbcfe941e609c5a8ca842 (tree)
parent 91f41bdc7095635b752af0ca3aee0a41ce864f8c
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 30 Jan 2025 18:24:29 -0800
std.heap.WasmAllocator: use `@splat` syntax
preferred over array multiplication where possible.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/std/heap/WasmAllocator.zig b/lib/std/heap/WasmAllocator.zig
@@ -40,11 +40,11 @@ const size_class_count = math.log2(bigpage_size) - min_class;
/// etc.
const big_size_class_count = math.log2(bigpage_count);
-var next_addrs = [1]usize{0} ** size_class_count;
+var next_addrs: [size_class_count]usize = @splat(0);
/// For each size class, points to the freed pointer.
-var frees = [1]usize{0} ** size_class_count;
+var frees: [size_class_count]usize = @splat(0);
/// For each big size class, points to the freed pointer.
-var big_frees = [1]usize{0} ** big_size_class_count;
+var big_frees: [big_size_class_count]usize = @splat(0);
fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[*]u8 {
_ = ctx;
@@ -160,7 +160,7 @@ fn allocBigPages(n: usize) usize {
return @as(usize, @intCast(page_index)) * wasm.page_size;
}
-const test_ally = Allocator{
+const test_ally: Allocator = .{
.ptr = undefined,
.vtable = &vtable,
};