]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/unbound/compat/memcmp.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / 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 }