Zig's @memcpy, copyForwards and copyBackwards

from blog openmymind.net, | ↗ original
If you've used Zig for a bit, you've probably come across the @memcpy builtin. It copies bytes from one region of memory to another. For example, if we wanted to concat two arrays, we could write a little helper: fn concat(comptime T: type, allocator: std.mem.Allocator, arr1: []const T, arr2: []const T) ![]T { var combined = try...