ORDERED_MASK_COMPARE(3)
NAME
ordered_mask_compare -- successive comparisons of a pair of
words against a series of masks
SYNOPSIS
#include <soi_fun.h>
extern int ordered_mask_compare (unsigned int a, unsigned int b,
int nmasks, ...)
DESCRIPTION
This function successively masks each of the pair of words a
and b against a series of nmasks masks. On encountering the
first case in which the masked values differ, the function
returns -1 if the masked value of a is less than that of b,
1 otherwise. If all requested comparisons are equal, the
function returns 0.
The masked values are compared arithmetically, so multi-bit
masks may be used.
EXAMPLES
#define FRACTION_MISSING (31 << 27)
#define REALLY_CRUMBY (1)
ordered_mask_compare (unsigned int a, unsigned int b, 2,
REALLY_CRUMBY, FRACTION_MISSING)
will return the number (-1 or 1) of whichever one of the two
test values has the low-order bit clear; if both have it
clear or set, it will return the number of whichever has a
lower numeric value in bits 27-31. If bits 0 and 27-31 are
identical in the test values, the function returns 0.
FILES
SEE ALSO
DIAGNOSTICS
BUGS
The comparison words and masks are assumed to be of length
sizeof (int).
AUTHOR
Rick Bogart
HISTORY
1998-03-25 SOI Version 2.10