authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-04 23:04:07-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-04 23:04:07-05:00
loge56f903522c07c959d22e81e7b4dedef9d0bd5cf
tree45215f4c1a1e0b0c28528c447728a1a222b784b8
parent64a0510205b4d224413de52fd87632fbe6bfe083

memset and memcpy implementations need not return dest


1 files changed, 8 insertions(+), 8 deletions(-)

std/builtin.zig+8-8
......@@ -1,31 +1,31 @@
11// These functions are provided when not linking against libc because LLVM
22// sometimes generates code that calls them.
33
4export fn memset(dest: ?&u8, c: u8, n: usize) -> ?&u8 {
4// Note that these functions do not return `dest`, like the libc API.
5// The semantics of these functions is dictated by the corresponding
6// LLVM intrinsics, not by the libc API.
7
8export fn memset(dest: ?&u8, c: u8, n: usize) {
59 @setDebugSafety(this, false);
610
711 if (n == 0)
8 return dest;
12 return;
913
1014 const d = ??dest;
1115 var index: usize = 0;
1216 while (index != n; index += 1)
1317 d[index] = c;
14
15 return dest;
1618}
1719
18export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) -> ?&u8 {
20export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) {
1921 @setDebugSafety(this, false);
2022
2123 if (n == 0)
22 return dest;
24 return;
2325
2426 const d = ??dest;
2527 const s = ??src;
2628 var index: usize = 0;
2729 while (index != n; index += 1)
2830 d[index] = s[index];
29
30 return dest;
3131}