2016-01-06 21:40:25 +08:00
|
|
|
// These functions are provided when not linking against libc because LLVM
|
|
|
|
// sometimes generates code that calls them.
|
|
|
|
|
2016-04-27 02:35:56 +08:00
|
|
|
#debug_safety(false)
|
2016-01-26 08:06:19 +08:00
|
|
|
export fn memset(dest: &u8, c: u8, n: isize) -> &u8 {
|
2016-05-12 04:18:28 +08:00
|
|
|
var index: isize = 0;
|
2016-01-06 21:40:25 +08:00
|
|
|
while (index != n) {
|
|
|
|
dest[index] = c;
|
|
|
|
index += 1;
|
|
|
|
}
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
2016-04-27 02:35:56 +08:00
|
|
|
#debug_safety(false)
|
2016-01-26 08:06:19 +08:00
|
|
|
export fn memcpy(noalias dest: &u8, noalias src: &const u8, n: isize) -> &u8 {
|
2016-05-12 04:18:28 +08:00
|
|
|
var index: isize = 0;
|
2016-01-06 21:40:25 +08:00
|
|
|
while (index != n) {
|
|
|
|
dest[index] = src[index];
|
|
|
|
index += 1;
|
|
|
|
}
|
|
|
|
return dest;
|
|
|
|
}
|