ucx
UAP Common Extensions
Loading...
Searching...
No Matches
Functions
compare.h File Reference

A collection of simple compare functions. More...

#include "common.h"

Go to the source code of this file.

Functions

int cx_cmp_int (void const *i1, void const *i2)
 Compares two integers of type int.
 
int cx_cmp_longint (void const *i1, void const *i2)
 Compares two integers of type long int.
 
int cx_cmp_longlong (void const *i1, void const *i2)
 Compares two integers of type long long.
 
int cx_cmp_int16 (void const *i1, void const *i2)
 Compares two integers of type int16_t.
 
int cx_cmp_int32 (void const *i1, void const *i2)
 Compares two integers of type int32_t.
 
int cx_cmp_int64 (void const *i1, void const *i2)
 Compares two integers of type int64_t.
 
int cx_cmp_uint (void const *i1, void const *i2)
 Compares two integers of type unsigned int.
 
int cx_cmp_ulongint (void const *i1, void const *i2)
 Compares two integers of type unsigned long int.
 
int cx_cmp_ulonglong (void const *i1, void const *i2)
 Compares two integers of type unsigned long long.
 
int cx_cmp_uint16 (void const *i1, void const *i2)
 Compares two integers of type uint16_t.
 
int cx_cmp_uint32 (void const *i1, void const *i2)
 Compares two integers of type uint32_t.
 
int cx_cmp_uint64 (void const *i1, void const *i2)
 Compares two integers of type uint64_t.
 
int cx_cmp_float (void const *f1, void const *f2)
 Compares two real numbers of type float with precision 1e-6f.
 
int cx_cmp_double (void const *d1, void const *d2)
 Compares two real numbers of type double with precision 1e-14.
 
int cx_cmp_intptr (void const *ptr1, void const *ptr2)
 Compares the integer representation of two pointers.
 
int cx_cmp_uintptr (void const *ptr1, void const *ptr2)
 Compares the unsigned integer representation of two pointers.
 

Detailed Description

A collection of simple compare functions.

Author
Mike Becker
Olaf Wintermann
Version
3.0

Function Documentation

◆ cx_cmp_double()

int cx_cmp_double ( void const *  d1,
void const *  d2 
)

Compares two real numbers of type double with precision 1e-14.

Parameters
d1pointer to double one
d2pointer to double two
Returns
-1, if *d1 is less than *d2, 0 if both are equal, 1 if *d1 is greater than *d2

◆ cx_cmp_float()

int cx_cmp_float ( void const *  f1,
void const *  f2 
)

Compares two real numbers of type float with precision 1e-6f.

Parameters
f1pointer to float one
f2pointer to float two
Returns
-1, if *f1 is less than *f2, 0 if both are equal, 1 if *f1 is greater than *f2

◆ cx_cmp_int()

int cx_cmp_int ( void const *  i1,
void const *  i2 
)

Compares two integers of type int.

Parameters
i1pointer to integer one
i2pointer to integer two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_int16()

int cx_cmp_int16 ( void const *  i1,
void const *  i2 
)

Compares two integers of type int16_t.

Parameters
i1pointer to int16_t one
i2pointer to int16_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_int32()

int cx_cmp_int32 ( void const *  i1,
void const *  i2 
)

Compares two integers of type int32_t.

Parameters
i1pointer to int32_t one
i2pointer to int32_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_int64()

int cx_cmp_int64 ( void const *  i1,
void const *  i2 
)

Compares two integers of type int64_t.

Parameters
i1pointer to int64_t one
i2pointer to int64_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_intptr()

int cx_cmp_intptr ( void const *  ptr1,
void const *  ptr2 
)

Compares the integer representation of two pointers.

Parameters
ptr1pointer to pointer one (intptr_t const*)
ptr2pointer to pointer two (intptr_t const*)
Returns
-1 if *ptr1 is less than *ptr2, 0 if both are equal, 1 if *ptr1 is greater than *ptr2

◆ cx_cmp_longint()

int cx_cmp_longint ( void const *  i1,
void const *  i2 
)

Compares two integers of type long int.

Parameters
i1pointer to long integer one
i2pointer to long integer two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_longlong()

int cx_cmp_longlong ( void const *  i1,
void const *  i2 
)

Compares two integers of type long long.

Parameters
i1pointer to long long one
i2pointer to long long two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_uint()

int cx_cmp_uint ( void const *  i1,
void const *  i2 
)

Compares two integers of type unsigned int.

Parameters
i1pointer to unsigned integer one
i2pointer to unsigned integer two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_uint16()

int cx_cmp_uint16 ( void const *  i1,
void const *  i2 
)

Compares two integers of type uint16_t.

Parameters
i1pointer to uint16_t one
i2pointer to uint16_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_uint32()

int cx_cmp_uint32 ( void const *  i1,
void const *  i2 
)

Compares two integers of type uint32_t.

Parameters
i1pointer to uint32_t one
i2pointer to uint32_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_uint64()

int cx_cmp_uint64 ( void const *  i1,
void const *  i2 
)

Compares two integers of type uint64_t.

Parameters
i1pointer to uint64_t one
i2pointer to uint64_t two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_uintptr()

int cx_cmp_uintptr ( void const *  ptr1,
void const *  ptr2 
)

Compares the unsigned integer representation of two pointers.

Parameters
ptr1pointer to pointer one (uintptr_t const*)
ptr2pointer to pointer two (uintptr_t const*)
Returns
-1 if *ptr1 is less than *ptr2, 0 if both are equal, 1 if *ptr1 is greater than *ptr2

◆ cx_cmp_ulongint()

int cx_cmp_ulongint ( void const *  i1,
void const *  i2 
)

Compares two integers of type unsigned long int.

Parameters
i1pointer to unsigned long integer one
i2pointer to unsigned long integer two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2

◆ cx_cmp_ulonglong()

int cx_cmp_ulonglong ( void const *  i1,
void const *  i2 
)

Compares two integers of type unsigned long long.

Parameters
i1pointer to unsigned long long one
i2pointer to unsigned long long two
Returns
-1, if *i1 is less than *i2, 0 if both are equal, 1 if *i1 is greater than *i2