summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/libfemto/std/memcmp.c
blob: 73932c93b3c0ae9386f92d33ec300a49ccb11267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// See LICENSE for license details.

#include <stddef.h>

int memcmp(const void *s1, const void *s2, size_t n)
{
    while (n-- > 0) {
        char c1 = *(const char*)s1++;
        char c2 = *(const char*)s2++;
        if (c1 != c2) {
            return c1 - c2;
        }
    }
    return 0;
}