3 ms·
var arr = std.mem.zeroes([30_000]u8); P.S: Not a loop. The implementation of std.mem.zeroes for an non-sentineled array is: return [_]info.child{zeroes(info
by AnIdiotOnTheNet 4y ago
var arr = std.mem.zeroes([30_000]u8);
P.S: Not a loop. The implementation of std.mem.zeroes for an non-sentineled array is:
return [_]info.child{zeroes(info.child)} ** info.len;
Which in this case will be equivalent to:
return [_]u8{0} ** 30_000;
Which uses the comptime-only `*` operator to expand the single-item u8 array with value 0 into an array of 30k 0s.