diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-11-06 14:29:39 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-11-06 14:29:39 +0200 |
commit | 2e0702c597e3099316c8c82379c3425ecc7a2dd2 (patch) | |
tree | 58860a91682a61d1e5bdf24b73617b4ad49b0de6 /lib/tst/mem.c | |
parent | makefile: replace ,SRCS with .SRCS (diff) | |
download | kernel-2e0702c597e3099316c8c82379c3425ecc7a2dd2.tar.xz |
lib/malloc: add linked list implementation
Diffstat (limited to 'lib/tst/mem.c')
-rw-r--r-- | lib/tst/mem.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tst/mem.c b/lib/tst/mem.c new file mode 100644 index 0000000..bccb3a3 --- /dev/null +++ b/lib/tst/mem.c @@ -0,0 +1,17 @@ +#include <assert.h> + +static const unsigned char data[] = {0xde, 0xca, 0xfa, 0xde}; +static unsigned char buffer[4]; + +void *memset(void *s, int c, long unsigned n); +void *memcpy(void *restrict dest, const void *restrict src, long unsigned n); + +int +main(void) +{ + memset(buffer, 0xae, sizeof(data)); + for (unsigned i = 0; i < sizeof(data); ++i) assert(buffer[i] == 0xae); + + memcpy(buffer, data, sizeof(data)); + for (unsigned i = 0; i < sizeof(data); ++i) assert(buffer[i] == data[i]); +} |