FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * cmp_addr_distance - compare two address distances, returning -1, 0,
 *		       1 to indicate their relationship.
 */
compare two address distances, returning -1, 0,
1 to indicate their relationship.
compare two address distances returning - 1 0 1 to indicate their relationship .
static int
cmp_addr_distance(
	const sockaddr_u *	d1,
	const sockaddr_u *	d2
	)
{
	int	i;
	REQUIRE(AF(d1) == AF(d2));
	if (IS_IPV4(d1)) {
		if (SRCADR(d1) < SRCADR(d2))
			return -1;
		else if (SRCADR(d1) == SRCADR(d2))
			return 0;
		else
			return 1;
	}
	for (i = 0; i < (int)sizeof(NSRCADR6(d1)); i++) {
		if (NSRCADR6(d1)[i] < NSRCADR6(d2)[i])
			return -1;
		else if (NSRCADR6(d1)[i] > NSRCADR6(d2)[i])
			return 1;
	}
	return 0;
}
static int cmp_addr_distance ( const sockaddr_u * d1 , const sockaddr_u * d2 ) { int i ; REQUIRE ( AF ( d1 ) == AF ( d2 ) ) ; if ( IS_IPV4 ( d1 ) ) { if ( SRCADR ( d1 ) < SRCADR ( d2 ) ) return -1 ; else if ( SRCADR ( d1 ) == SRCADR ( d2 ) ) return 0 ; else return 1 ; } for ( i = 0 ; i < ( int ) sizeof ( NSRCADR6 ( d1 ) ) ; i ++ ) { if ( NSRCADR6 ( d1 ) [ i ] < NSRCADR6 ( d2 ) [ i ] ) return -1 ; else if ( NSRCADR6 ( d1 ) [ i ] > NSRCADR6 ( d2 ) [ i ] ) return 1 ; } return 0 ; }
cmp_addr_distance - compare two address distances, returning -1, 0,
                     1 to indicate their relationship.
cmp_addr_distance - compare two address distances returning - 1 0 1 to indicate their relationship .