|
The Stanford cslib package
|
This interface exports several comparison functions for use with the
other library packages.
Type |
CompareFn | This type defines the type space of comparison functions, each of which take the addresses of their arguments and return an integer from the set {-1, 0, +1} depending on whether the first argument is less than, equal to, or greater than the second. |
Functions |
intCmpFn | Compares two values of type int whose addresses are supplied by the pointer arguments p1 and p2 . |
shortCmpFn | Compares two values of type short whose addresses are supplied by the pointer arguments p1 and p2 . |
longCmpFn | Compares two values of type long whose addresses are supplied by the pointer arguments p1 and p2 . |
charCmpFn | Compares two values of type char whose addresses are supplied by the pointer arguments p1 and p2 . |
floatCmpFn | Compares two values of type float whose addresses are supplied by the pointer arguments p1 and p2 . |
doubleCmpFn | Compares two values of type double whose addresses are supplied by the pointer arguments p1 and p2 . |
unsignedCmpFn | Compares two values of type unsigned whose addresses are supplied by the pointer arguments p1 and p2 . |
unsignedShortCmpFn | Compares two values of type unsignedshort whose addresses are supplied by the pointer arguments p1 and p2 . |
unsignedLongCmpFn | Compares two values of type unsignedlong whose addresses are supplied by the pointer arguments p1 and p2 . |
unsignedCharCmpFn | Compares two values of type unsignedchar whose addresses are supplied by the pointer arguments p1 and p2 . |
stringCmpFn | Compares two values of type string whose addresses are supplied by the pointer arguments p1 and p2 . |
pointerCmpFn | Compares two values of type pointer whose addresses are supplied by the pointer arguments p1 and p2 . |
Type detail
typedef int CompareFn(*CompareFn)(const void *p1, const void *p2);
This type defines the type space of comparison functions,
each of which take the addresses of their arguments and
return an integer from the set {-1, 0, +1} depending on
whether the first argument is less than, equal to, or
greater than the second.
Function detail
int intCmpFn(const void *p1, const void *p2);
Compares two values of type int
whose addresses are
supplied by the pointer arguments p1
and p2
.
int shortCmpFn(const void *p1, const void *p2);
Compares two values of type short
whose addresses are
supplied by the pointer arguments p1
and p2
.
int longCmpFn(const void *p1, const void *p2);
Compares two values of type long
whose addresses are
supplied by the pointer arguments p1
and p2
.
int charCmpFn(const void *p1, const void *p2);
Compares two values of type char
whose addresses are
supplied by the pointer arguments p1
and p2
.
int floatCmpFn(const void *p1, const void *p2);
Compares two values of type float
whose addresses are
supplied by the pointer arguments p1
and p2
.
int doubleCmpFn(const void *p1, const void *p2);
Compares two values of type double
whose addresses are
supplied by the pointer arguments p1
and p2
.
int unsignedCmpFn(const void *p1, const void *p2);
Compares two values of type unsigned
whose addresses are
supplied by the pointer arguments p1
and p2
.
int unsignedShortCmpFn(const void *p1, const void *p2);
Compares two values of type unsignedshort
whose addresses are
supplied by the pointer arguments p1
and p2
.
int unsignedLongCmpFn(const void *p1, const void *p2);
Compares two values of type unsignedlong
whose addresses are
supplied by the pointer arguments p1
and p2
.
int unsignedCharCmpFn(const void *p1, const void *p2);
Compares two values of type unsignedchar
whose addresses are
supplied by the pointer arguments p1
and p2
.
int stringCmpFn(const void *p1, const void *p2);
Compares two values of type string
whose addresses are
supplied by the pointer arguments p1
and p2
.
int pointerCmpFn(const void *p1, const void *p2);
Compares two values of type pointer
whose addresses are
supplied by the pointer arguments p1
and p2
.
Pointer comparison is based on the numeric equivalent of the pointer.