aboutsummaryrefslogtreecommitdiff
path: root/libc/string.c
blob: 8a9e422fd7e17b6fa735f5529630c9d1ab9a00e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdint.h>
#include <stddef.h>
#include "string.h"

int strlen(const char *str)
{
    int len = 0;
    while(*str++)
        len++;
    return len;
}

void* memset(void *buf, int val, size_t sz)
{
    for(size_t i = 0; i < sz; ++i)
    {
        ((uint8_t*)buf)[i] = (uint8_t) val;
    }
    return buf;
}