FreeBSD/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
/*
 * Compare two attributes and return an integer value in the following ranges:
 *
 * <0 if any of a1's attributes are less than a2's attributes
 * =0 if all of a1's attributes are equal to a2's attributes
 * >0 if all of a1's attributes are greater than or equal to a2's attributes
 *
 * To implement this function efficiently, we subtract a2's attributes from
 * a1's to obtain a negative result if an a1 attribute is less than its a2
 * counterpart.  We then OR the intermediate results together, relying on the
 * twos-complement property that if any result is negative, the bitwise union
 * will also be negative since the highest bit will be set in the result.
 */


To implement this function efficiently, we subtract a2's attributes from
a1's to obtain a negative result if an a1 attribute is less than its a2
counterpart.  We then OR the intermediate results together, relying on the
twos-complement property that if any result is negative, the bitwise union
will also be negative since the highest bit will be set in the result.
To implement this function efficiently we subtract a2 ' s attributes from a1 ' s to obtain a negative result if an a1 attribute is less than its a2 counterpart . We then OR the intermediate results together relying on the twos - complement property that if any result is negative the bitwise union will also be negative since the highest bit will be set in the result .
int
dt_attr_cmp(dtrace_attribute_t a1, dtrace_attribute_t a2)
{
	return (((int)a1.dtat_name - a2.dtat_name) |
	    ((int)a1.dtat_data - a2.dtat_data) |
	    ((int)a1.dtat_class - a2.dtat_class));
}
int dt_attr_cmp ( dtrace_attribute_t a1 , dtrace_attribute_t a2 ) { return ( ( ( int ) a1 . dtat_name - a2 . dtat_name ) | ( ( int ) a1 . dtat_data - a2 . dtat_data ) | ( ( int ) a1 . dtat_class - a2 . dtat_class ) ) ; }
Compare two attributes and return an integer value in the following ranges:
 <0 if any of a1's attributes are less than a2's attributes
 =0 if all of a1's attributes are equal to a2's attributes
 >0 if all of a1's attributes are greater than or equal to a2's attributes
Compare two attributes and return an integer value in the following ranges : <0 if any of a1 ' s attributes are less than a2 ' s attributes = 0 if all of a1 ' s attributes are equal to a2 ' s attributes > 0 if all of a1 ' s attributes are greater than or equal to a2 ' s attributes