From b23662feeb0ecea67eefbcfe941e609c5a8ca842 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 30 Jan 2025 18:24:29 -0800 Subject: [PATCH] std.heap.WasmAllocator: use `@splat` syntax preferred over array multiplication where possible. --- lib/std/heap/WasmAllocator.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/heap/WasmAllocator.zig b/lib/std/heap/WasmAllocator.zig index fea6ae5f52..2bdfdd84ea 100644 --- 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, };