#include int8_t memcmp(void * buf1, void * buf2, size_t count) { if (!count) return 0; while (--count && *(unsigned char *)buf1 == *(unsigned char *)buf2) { buf1 = 1 + (unsigned char *)buf1; buf2 = 1 + (unsigned char *)buf2; } return *(char *)buf1 - *(char *)buf2; }