]> git.saurik.com Git - apple/network_cmds.git/blob - unbound/compat/memcmp.c
9446276f410a3d1d781633cd011a4cc0f16e12e8
[apple/network_cmds.git] / unbound / compat / memcmp.c
1 /*
2 * memcmp.c: memcmp compat implementation.
3 *
4 * Copyright (c) 2010, NLnet Labs. All rights reserved.
5 *
6 * See LICENSE for the license.
7 */
8
9 #include <config.h>
10
11 int memcmp(const void *x, const void *y, size_t n);
12
13 int memcmp(const void *x, const void *y, size_t n)
14 {
15 const uint8_t* x8 = (const uint8_t*)x;
16 const uint8_t* y8 = (const uint8_t*)y;
17 size_t i;
18 for(i=0; i<n; i++) {
19 if(x8[i] < y8[i])
20 return -1;
21 else if(x8[i] > y8[i])
22 return 1;
23 }
24 return 0;
25 }