diff options
| author | Ada Christine <adachristine18@gmail.com> | 2021-03-29 01:41:50 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2021-03-29 01:41:50 +0000 |
| commit | 42c6af83ec7e26983f1ecdefc81ea481a2354cb4 (patch) | |
| tree | a096824a181eff4874e7840d148f3e5a06e3a5df /lib/memcmp.c | |
| parent | 56ec6c782455f7d8e4560d30ad6d2c3e1cd2738f (diff) | |
don't echo command spam
move common files to new source
add VPATH to loader and kernel makefiles for common source
Diffstat (limited to 'lib/memcmp.c')
| -rw-r--r-- | lib/memcmp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/memcmp.c b/lib/memcmp.c new file mode 100644 index 0000000..2348afe --- /dev/null +++ b/lib/memcmp.c @@ -0,0 +1,16 @@ +/* Public domain. */ +#include <stddef.h> + +int +memcmp (const void *str1, const void *str2, size_t count) +{ + const unsigned char *s1 = str1; + const unsigned char *s2 = str2; + + while (count-- > 0) + { + if (*s1++ != *s2++) + return s1[-1] < s2[-1] ? -1 : 1; + } + return 0; +} |
