Add memcmp(), clean up bochsrc.txt
This commit is contained in:
@@ -60,3 +60,16 @@ usize_t strlen(const char *str) {
|
||||
for (s = str; *s; ++s);
|
||||
return (s - str);
|
||||
}
|
||||
|
||||
int memcmp(const void *s1, const void *s2, usize_t n) {
|
||||
unsigned char *p = (unsigned char *)s1;
|
||||
unsigned char *q = (unsigned char *)s2;
|
||||
|
||||
while (n--) {
|
||||
if (*p != *q) {
|
||||
return (int)*p - (int)*q;
|
||||
}
|
||||
p++, q++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user