AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
libc.c
Go to the documentation of this file.
1
7
8
#include <
stddef.h
>
9
11
void
*
memcpy
(
void
*dst,
const
void
*src,
size_t
n)
12
{
13
char
*d = dst;
14
const
char
*s = src;
15
16
while
(n--)
17
*d++ = *s++;
18
19
return
dst;
20
}
21
23
void
*
memset
(
void
*dst,
int
c,
size_t
n)
24
{
25
char
*d = dst;
26
27
while
(n--)
28
*d++ = (char) c;
29
30
return
dst;
31
}
32
34
void
*
memmove
(
void
*dst,
const
void
*src,
size_t
n)
35
{
36
char
*d = dst;
37
const
char
*s = src;
38
39
if
(d < s) {
40
while
(n--)
41
*d++ = *s++;
42
}
else
{
43
while
(n--)
44
d[n] = s[n];
45
}
46
47
return
dst;
48
}
49
51
int
memcmp
(
const
void
*a,
const
void
*b,
size_t
n)
52
{
53
const
unsigned
char
*x = a, *y = b;
54
55
for
(; n--; ++x, ++y)
56
if
(*x != *y)
57
return
*x - *y;
58
59
return
0;
60
}
memcmp
int memcmp(const void *a, const void *b, size_t n)
Compares n bytes.
Definition
libc.c:51
memmove
void * memmove(void *dst, const void *src, size_t n)
Copies n bytes; dst and src may overlap.
Definition
libc.c:34
memset
void * memset(void *dst, int c, size_t n)
Sets n bytes to c.
Definition
libc.c:23
memcpy
void * memcpy(void *dst, const void *src, size_t n)
Copies n bytes; dst and src must not overlap.
Definition
libc.c:11
stddef.h
kernel
arch
aarch64
cpu
libc.c
Generated by
1.18.0