ti83-sdk/lib83/memcmp.c

14 lines
298 B
C
Raw Permalink Normal View History

2023-10-08 12:58:45 +00:00
#include <string.h>
int8_t memcmp(void * buf1, void * buf2, size_t count) {
if (!count) return 0;
2023-10-08 16:20:19 +00:00
while (--count && *(unsigned char *)buf1 == *(unsigned char *)buf2) {
2023-10-08 12:58:45 +00:00
buf1 = 1 + (unsigned char *)buf1; buf2 = 1 + (unsigned char *)buf2;
}
2023-10-08 16:20:19 +00:00
return *(char *)buf1 - *(char *)buf2;
2023-10-08 12:58:45 +00:00
}