zig/std/builtin.zig
2016-01-08 17:52:45 -07:00

22 lines
543 B
Zig

// These functions are provided when not linking against libc because LLVM
// sometimes generates code that calls them.
export fn memset(dest: &u8, c: u8, n: usize) -> &u8 {
var index : #typeof(n) = 0;
while (index != n) {
dest[index] = c;
index += 1;
}
return dest;
}
// TODO annotate parameters with noalias
export fn memcpy(dest: &u8, src: &const u8, n: usize) -> &u8 {
var index : #typeof(n) = 0;
while (index != n) {
dest[index] = src[index];
index += 1;
}
return dest;
}