MCPcopy Create free account
hub / github.com/apache/nuttx / memcmp

Function memcmp

libs/libc/string/lib_memcmp.c:40–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38#undef memcmp
39no_builtin("memcmp")
40int memcmp(FAR const void *s1, FAR const void *s2, size_t n)
41{
42 FAR unsigned char *p1 = (FAR unsigned char *)s1;
43 FAR unsigned char *p2 = (FAR unsigned char *)s2;
44
45 while (n-- > 0)
46 {
47 if (*p1 < *p2)
48 {
49 return -1;
50 }
51 else if (*p1 > *p2)
52 {
53 return 1;
54 }
55
56 p1++;
57 p2++;
58 }
59
60 return 0;
61}
62#endif

Callers 2

memmemFunction · 0.70
strstrFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected