PatchworkOS
Loading...
Searching...
No Matches
memcmp.c
Go to the documentation of this file.
1#include <string.h>
2
3int memcmp(const void* s1, const void* s2, size_t n)
4{
5 const unsigned char* p1 = (const unsigned char*)s1;
6 const unsigned char* p2 = (const unsigned char*)s2;
7
8 while (n--)
9 {
10 if (*p1 != *p2)
11 {
12 return *p1 - *p2;
13 }
14
15 ++p1;
16 ++p2;
17 }
18
19 return 0;
20}
int memcmp(const void *s1, const void *s2, size_t n)
Definition memcmp.c:3