/* Compares the prefix of two abstract address objects.  */
int nl_addr_cmp_prefix(struct nl_addr *a, struct nl_addr *b)
/* Compares the prefix of two abstract address objects.  */
int nl_addr_cmp_prefix(struct nl_addr *a, struct nl_addr *b)
{
	int d = a->a_family - b->a_family;
	if (d == 0) {
		int len = min(a->a_prefixlen, b->a_prefixlen);
		int bytes = len / 8;
		d = memcmp(a->a_addr, b->a_addr, bytes);
		if (d == 0) {
			int mask = (1UL << (len % 8)) - 1UL;
			d = (a->a_addr[bytes] & mask) -
			    (b->a_addr[bytes] & mask);
		}
	}
	return d;
}