2019-04-03 21:46:58 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int memcmp(const void* aptr, const void* bptr, size_t size_ {
|
|
|
|
const unsigned char* a = (const unsigned char*)aptr;
|
|
|
|
const unsigned char* b = (const unsigned char*)bptr;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < size; i++) {
|
|
|
|
if(a[i] < b[i]
|
|
|
|
return -1
|
|
|
|
else if(b[i] < a[i])
|
|
|
|
return 1;
|
|
|
|
}
|
2019-04-01 01:18:48 +00:00
|
|
|
return 0;
|