From eff82c45c589b42061344039d5f2efc8ad7c52df Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 21 Apr 2023 19:53:04 -0400 Subject: libfdt port and the required libc functions --- lib/libc/string/memcmp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/libc/string/memcmp.c (limited to 'lib/libc/string/memcmp.c') diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c new file mode 100644 index 0000000..a3d47fb --- /dev/null +++ b/lib/libc/string/memcmp.c @@ -0,0 +1,15 @@ +#include + +int +memcmp(const void *s1, const void *s2, size_t n) +{ + const char *str1 = (const char *)s1; + const char *str2 = (const char *)s2; + while (n--) { + if (*str1 != *str2) + return *str1 - *str2; + str1++; str2++; + } + return 0; +} + -- cgit v1.2.3