Modules

Memory

moduleSource

Available on macOS, Linux, Windows, Wasm

#import "Memory";

Byte-copying helpers. copy is the one to use.

Module parameters#

with_candidates := false
Adds copy_0 and the other competing implementations, for comparing speeds.
with_unwraps := false
Adds the unrolled fixed-size copies, such as copy_128.

Procedures#

(destination: *void, source: *void, count: s64)

Copies count bytes from source to destination. The two ranges may overlap.

data := u8.[1, 2, 3, 4, 5];
copy(data.data + 1, data.data, 4); // shift right by one
assert(data[1] == 1 && data[4] == 4);
↗
(destination: *void, source: *void, count: s64)