authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-30 18:24:29-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-06 14:23:23-08:00
logb23662feeb0ecea67eefbcfe941e609c5a8ca842
tree827f0dc0045cf6afb850d30d7114dc52836cb1b3
parent91f41bdc7095635b752af0ca3aee0a41ce864f8c

std.heap.WasmAllocator: use `@splat` syntax

preferred over array multiplication where possible.

1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/heap/WasmAllocator.zig+4-4
......@@ -40,11 +40,11 @@ const size_class_count = math.log2(bigpage_size) - min_class;
4040/// etc.
4141const big_size_class_count = math.log2(bigpage_count);
4242
43var next_addrs = [1]usize{0} ** size_class_count;
43var next_addrs: [size_class_count]usize = @splat(0);
4444/// For each size class, points to the freed pointer.
45var frees = [1]usize{0} ** size_class_count;
45var frees: [size_class_count]usize = @splat(0);
4646/// For each big size class, points to the freed pointer.
47var big_frees = [1]usize{0} ** big_size_class_count;
47var big_frees: [big_size_class_count]usize = @splat(0);
4848
4949fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[*]u8 {
5050 _ = ctx;
......@@ -160,7 +160,7 @@ fn allocBigPages(n: usize) usize {
160160 return @as(usize, @intCast(page_index)) * wasm.page_size;
161161}
162162
163const test_ally = Allocator{
163const test_ally: Allocator = .{
164164 .ptr = undefined,
165165 .vtable = &vtable,
166166};