4 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (c) 1996,1999 by Internet Software Consortium.
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 * compare bit masks l and r, for n bits.
30 * -1, 1, or 0 in the libc tradition.
32 * network byte order assumed. this means 192.5.5.240/28 has
33 * 0x11110000 in its fourth octet.
35 * Paul Vixie (ISC), June 1996
38 ares_bitncmp(const void *l, const void *r, int n) {
47 lb = ((const unsigned char *)l)[b];
48 rb = ((const unsigned char *)r)[b];
49 for (b = n % 8; b > 0; b--) {
50 if ((lb & 0x80) != (rb & 0x80)) {