@memset

@memset

@memset(dest: [*]u8, c: u8, byte_count: usize)

This function sets a region of memory to c. dest is a pointer.

This function is a low level intrinsic with no safety mechanisms. Most code should not use this function, instead using something like this:

for (dest[0..byte_count]) |*b| b.* = c;

The optimizer is intelligent enough to turn the above snippet into a memset.

There is also a standard library function for this:

const mem = @import("std").mem;
mem.set(u8, dest, c);