blob: 572adf00cc3d4abafa7ae5b1f2d86f9fe6021bd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// 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 {
var index : #typeof(n) = 0;
while (index != n) {
dest[index] = c;
index += 1;
}
return dest;
}
// TODO annotate parameters with noalias
export fn memcpy(dest: &u8, src: &const u8, n: usize) -> &u8 {
var index : #typeof(n) = 0;
while (index != n) {
dest[index] = src[index];
index += 1;
}
return dest;
}
|