zig/std/builtin.zig
Andrew Kelley b581da41f8 remove compiler directives
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`,
   `setFnNoInline` builtin functions to replace previous
   directive functionality
 * add `coldcc` and `nakedcc` as keywords which can be used as part
   of a function prototype.
 * `setDebugSafety` builtin can be used to set debug safety features
   at a per block scope level.
 * closes #169
2016-09-28 02:33:32 -04:00

25 lines
576 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 {
@setDebugSafety(this, false);
var index: usize = 0;
while (index != n) {
dest[index] = c;
index += 1;
}
return dest;
}
export fn memcpy(noalias dest: &u8, noalias src: &const u8, n: usize) -> &u8 {
@setDebugSafety(this, false);
var index: usize = 0;
while (index != n) {
dest[index] = src[index];
index += 1;
}
return dest;
}