ucx/cx/compare.h

changeset 2
fbdfaacc4182
parent 0
2483f517c562
equal deleted inserted replaced
1:b5bb7b3cd597 2:fbdfaacc4182
28 /** 28 /**
29 * \file compare.h 29 * \file compare.h
30 * \brief A collection of simple compare functions. 30 * \brief A collection of simple compare functions.
31 * \author Mike Becker 31 * \author Mike Becker
32 * \author Olaf Wintermann 32 * \author Olaf Wintermann
33 * \version 3.0
34 * \copyright 2-Clause BSD License 33 * \copyright 2-Clause BSD License
35 */ 34 */
36 35
37 #ifndef UCX_COMPARE_H 36 #ifndef UCX_COMPARE_H
38 #define UCX_COMPARE_H 37 #define UCX_COMPARE_H
40 #include "common.h" 39 #include "common.h"
41 40
42 #ifdef __cplusplus 41 #ifdef __cplusplus
43 extern "C" { 42 extern "C" {
44 #endif 43 #endif
44
45 #ifndef CX_COMPARE_FUNC_DEFINED
46 #define CX_COMPARE_FUNC_DEFINED
47 /**
48 * A comparator function comparing two collection elements.
49 */
50 typedef int(*cx_compare_func)(
51 void const *left,
52 void const *right
53 );
54 #endif // CX_COMPARE_FUNC_DEFINED
45 55
46 /** 56 /**
47 * Compares two integers of type int. 57 * Compares two integers of type int.
48 * 58 *
49 * @param i1 pointer to integer one 59 * @param i1 pointer to integer one
211 int cx_cmp_uintptr( 221 int cx_cmp_uintptr(
212 void const *ptr1, 222 void const *ptr1,
213 void const *ptr2 223 void const *ptr2
214 ); 224 );
215 225
226 /**
227 * Compares the pointers specified in the arguments without de-referencing.
228 *
229 * @param ptr1 pointer one
230 * @param ptr2 pointer two
231 * @return -1 if ptr1 is less than ptr2, 0 if both are equal,
232 * 1 if ptr1 is greater than ptr2
233 */
234 int cx_cmp_ptr(
235 void const *ptr1,
236 void const *ptr2
237 );
238
216 #ifdef __cplusplus 239 #ifdef __cplusplus
217 } // extern "C" 240 } // extern "C"
218 #endif 241 #endif
219 242
220 #endif //UCX_COMPARE_H 243 #endif //UCX_COMPARE_H

mercurial