aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-05-02 19:20:23 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-05-02 19:20:23 -0400
commit3b921afc69139c7290d04cd33a95cb221d5d481f (patch)
tree0f454bb3e8d49539275640a6b02efe44d6f6a886
parentf87be94f6a4277823eeaab12cd581fd5cedff19b (diff)
downloadzig-3b921afc69139c7290d04cd33a95cb221d5d481f.tar.gz
zig-3b921afc69139c7290d04cd33a95cb221d5d481f.zip
slightly better memset/memcpy implementation
-rw-r--r--std/special/builtin.zig13
1 files changed, 2 insertions, 11 deletions
diff --git a/std/special/builtin.zig b/std/special/builtin.zig
index 38100329e3..110b962630 100644
--- a/std/special/builtin.zig
+++ b/std/special/builtin.zig
@@ -9,26 +9,17 @@ const builtin = @import("builtin");
export fn memset(dest: ?&u8, c: u8, n: usize) {
@setDebugSafety(this, false);
- if (n == 0)
- return;
-
- const d = ??dest;
var index: usize = 0;
while (index != n; index += 1)
- d[index] = c;
+ (??dest)[index] = c;
}
export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) {
@setDebugSafety(this, false);
- if (n == 0)
- return;
-
- const d = ??dest;
- const s = ??src;
var index: usize = 0;
while (index != n; index += 1)
- d[index] = s[index];
+ (??dest)[index] = (??src)[index];
}
export fn __stack_chk_fail() {