diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/string.c | 19 | ||||
| -rw-r--r-- | libc/string.h | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libc/string.c b/libc/string.c new file mode 100644 index 0000000..33ccad9 --- /dev/null +++ b/libc/string.c @@ -0,0 +1,19 @@ +#include <stdint.h> +#include "string.h" + +int strlen(const char *str) +{ + int len = 0; + while(s++) + len++; + return len; +} + +void* memset(void *buf, int val, size_t sz) +{ + for(size_t i = 0; i < sz; ++i) + { + buf[i] = (uint8_t) val; + } + return buf; +} diff --git a/libc/string.h b/libc/string.h new file mode 100644 index 0000000..8606fab --- /dev/null +++ b/libc/string.h @@ -0,0 +1,3 @@ +#include <stdint.h> +int strlen(const char*); +void* memset(void*, int, size_t); |