diff options
Diffstat (limited to 'src/string/memcmp.c')
-rw-r--r-- | src/string/memcmp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string/memcmp.c b/src/string/memcmp.c new file mode 100644 index 00000000..bdbce9f0 --- /dev/null +++ b/src/string/memcmp.c @@ -0,0 +1,8 @@ +#include <string.h> + +int memcmp(const void *vl, const void *vr, size_t n) +{ + const unsigned char *l=vl, *r=vr; + for (; n && *l == *r; n--, l++, r++); + return n ? *l-*r : 0; +} |