authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-05-02 19:20:23-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-05-02 19:20:23-04:00
log3b921afc69139c7290d04cd33a95cb221d5d481f
tree0f454bb3e8d49539275640a6b02efe44d6f6a886
parentf87be94f6a4277823eeaab12cd581fd5cedff19b

slightly better memset/memcpy implementation


1 files changed, 2 insertions(+), 11 deletions(-)

std/special/builtin.zig+2-11
......@@ -9,26 +9,17 @@ const builtin = @import("builtin");
99export fn memset(dest: ?&u8, c: u8, n: usize) {
1010 @setDebugSafety(this, false);
1111
12 if (n == 0)
13 return;
14
15 const d = ??dest;
1612 var index: usize = 0;
1713 while (index != n; index += 1)
18 d[index] = c;
14 (??dest)[index] = c;
1915}
2016
2117export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) {
2218 @setDebugSafety(this, false);
2319
24 if (n == 0)
25 return;
26
27 const d = ??dest;
28 const s = ??src;
2920 var index: usize = 0;
3021 while (index != n; index += 1)
31 d[index] = s[index];
22 (??dest)[index] = (??src)[index];
3223}
3324
3425export fn __stack_chk_fail() {