summaryrefslogtreecommitdiff
path: root/userland/libc/string/memcmp.c
blob: 01109b874286fb5975c17559229dbb2cace37d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <string.h>

int memcmp(const void *s1, const void *s2, size_t n) {
  int return_value = 0;

  for (uint32_t i = 0; i < n; i++)
    if (((unsigned char *)(s1))[i] != ((unsigned char *)(s2))[i])
      return_value++;

  return return_value;
}