src/cx/compare.h

Wed, 17 Dec 2025 19:05:50 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 17 Dec 2025 19:05:50 +0100
changeset 1618
ef7cab6eb131
parent 1426
3a89b31f0724
permissions
-rw-r--r--

huge refactoring of collections to add support for 3-arg compare functions

601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 *
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 */
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 /**
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
29 * @file compare.h
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
30 * @brief A collection of simple compare functions.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
31 * @author Mike Becker
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
32 * @author Olaf Wintermann
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
33 * @copyright 2-Clause BSD License
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 */
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 #ifndef UCX_COMPARE_H
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 #define UCX_COMPARE_H
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38
648
77021e06b1a8 fix code not compiling under windows+mingw
Mike Becker <universe@uap-core.de>
parents: 631
diff changeset
39 #include "common.h"
77021e06b1a8 fix code not compiling under windows+mingw
Mike Becker <universe@uap-core.de>
parents: 631
diff changeset
40
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 #ifdef __cplusplus
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 extern "C" {
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 #endif
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44
786
b0ebb3d88407 declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents: 762
diff changeset
45 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
46 * A comparator function comparing two arbitrary values.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
47 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
48 * All functions from compare.h with the cx_cmp prefix are
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
49 * compatible with this signature and can be used as
1424
563033aa998c fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents: 1399
diff changeset
50 * compare function for collections or other implementations
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
51 * that need to be type-agnostic.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
52 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
53 * For simple comparisons the cx_vcmp family of functions
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
54 * can be used, but they are NOT compatible with this function
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
55 * pointer.
786
b0ebb3d88407 declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents: 762
diff changeset
56 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
57 typedef int (*cx_compare_func)(const void *left, const void *right);
786
b0ebb3d88407 declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents: 762
diff changeset
58
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 /**
1618
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
60 * A comparator function comparing two arbitrary values.
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
61 *
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
62 * Functions with this signature allow specifying a pointer to custom data.
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
63 */
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
64 typedef int (*cx_compare_func2)(const void *left, const void *right, void *data);
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
65
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
66 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 * Compares two integers of type int.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
69 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
70 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
71 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 * @param i1 pointer to integer one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 * @param i2 pointer to integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
74 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
75 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
76 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
78 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
79 CX_EXPORT int cx_cmp_int(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
82 * Compares two integers of type int.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
83 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
84 * @param i1 integer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
85 * @param i2 integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
86 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
87 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
88 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
89 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
90 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
91 CX_EXPORT int cx_vcmp_int(int i1, int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
92
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
93 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
94 * Compares two integers of type long int.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
96 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
97 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
98 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 * @param i1 pointer to long integer one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100 * @param i2 pointer to long integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
101 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
102 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
103 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
105 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
106 CX_EXPORT int cx_cmp_longint(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
109 * Compares two integers of type long int.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
110 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
111 * @param i1 long integer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
112 * @param i2 long integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
113 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
114 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
115 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
116 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
117 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
118 CX_EXPORT int cx_vcmp_longint(long int i1, long int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
119
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
120 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 * Compares two integers of type long long.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
123 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
124 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
125 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 * @param i1 pointer to long long one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 * @param i2 pointer to long long two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
128 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
129 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
130 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
132 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
133 CX_EXPORT int cx_cmp_longlong(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
136 * Compares two integers of type long long.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
137 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
138 * @param i1 long long int one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
139 * @param i2 long long int two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
140 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
141 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
142 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
143 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
144 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
145 CX_EXPORT int cx_vcmp_longlong(long long int i1, long long int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
146
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
147 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148 * Compares two integers of type int16_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
150 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
151 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
152 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 * @param i1 pointer to int16_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
154 * @param i2 pointer to int16_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
155 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
156 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
157 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
159 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
160 CX_EXPORT int cx_cmp_int16(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
163 * Compares two integers of type int16_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
164 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
165 * @param i1 int16_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
166 * @param i2 int16_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
167 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
168 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
169 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
170 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
171 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
172 CX_EXPORT int cx_vcmp_int16(int16_t i1, int16_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
173
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
174 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 * Compares two integers of type int32_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
177 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
178 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
179 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180 * @param i1 pointer to int32_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181 * @param i2 pointer to int32_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
182 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
183 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
184 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
186 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
187 CX_EXPORT int cx_cmp_int32(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
188
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
189 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
190 * Compares two integers of type int32_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
191 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
192 * @param i1 int32_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
193 * @param i2 int32_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
194 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
195 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
196 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
197 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
198 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
199 CX_EXPORT int cx_vcmp_int32(int32_t i1, int32_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
200
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
201 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
202 * Compares two integers of type int64_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
203 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
204 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
205 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
206 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
207 * @param i1 pointer to int64_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
208 * @param i2 pointer to int64_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
209 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
210 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
211 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
212 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
213 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
214 CX_EXPORT int cx_cmp_int64(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
215
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
217 * Compares two integers of type int64_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
218 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
219 * @param i1 int64_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
220 * @param i2 int64_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
221 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
222 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
223 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
224 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
225 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
226 CX_EXPORT int cx_vcmp_int64(int64_t i1, int64_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
227
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
228 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
229 * Compares two integers of type unsigned int.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
230 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
231 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
232 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
233 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
234 * @param i1 pointer to unsigned integer one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
235 * @param i2 pointer to unsigned integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
236 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
237 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
238 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
239 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
240 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
241 CX_EXPORT int cx_cmp_uint(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
242
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
243 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
244 * Compares two integers of type unsigned int.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
245 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
246 * @param i1 unsigned integer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
247 * @param i2 unsigned integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
248 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
249 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
250 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
251 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
252 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
253 CX_EXPORT int cx_vcmp_uint(unsigned int i1, unsigned int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
254
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
255 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
256 * Compares two integers of type unsigned long int.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
257 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
258 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
259 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
260 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
261 * @param i1 pointer to unsigned long integer one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
262 * @param i2 pointer to unsigned long integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
263 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
264 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
265 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
266 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
267 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
268 CX_EXPORT int cx_cmp_ulongint(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
269
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
270 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
271 * Compares two integers of type unsigned long int.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
272 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
273 * @param i1 unsigned long integer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
274 * @param i2 unsigned long integer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
275 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
276 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
277 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
278 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
279 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
280 CX_EXPORT int cx_vcmp_ulongint(unsigned long int i1, unsigned long int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
281
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
282 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
283 * Compares two integers of type unsigned long long.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
284 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
285 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
286 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
287 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
288 * @param i1 pointer to unsigned long long one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
289 * @param i2 pointer to unsigned long long two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
290 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
291 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
292 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
293 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
294 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
295 CX_EXPORT int cx_cmp_ulonglong(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
296
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
298 * Compares two integers of type unsigned long long.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
299 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
300 * @param i1 unsigned long long one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
301 * @param i2 unsigned long long two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
302 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
303 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
304 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
305 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
306 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
307 CX_EXPORT int cx_vcmp_ulonglong(unsigned long long int i1, unsigned long long int i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
308
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
309 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
310 * Compares two integers of type uint16_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
311 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
312 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
313 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
314 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
315 * @param i1 pointer to uint16_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
316 * @param i2 pointer to uint16_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
317 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
318 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
319 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
320 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
321 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
322 CX_EXPORT int cx_cmp_uint16(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
323
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
324 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
325 * Compares two integers of type uint16_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
326 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
327 * @param i1 uint16_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
328 * @param i2 uint16_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
329 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
330 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
331 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
332 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
333 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
334 CX_EXPORT int cx_vcmp_uint16(uint16_t i1, uint16_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
335
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
336 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
337 * Compares two integers of type uint32_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
338 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
339 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
340 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
341 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
342 * @param i1 pointer to uint32_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
343 * @param i2 pointer to uint32_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
344 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
345 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
346 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
347 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
348 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
349 CX_EXPORT int cx_cmp_uint32(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
350
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
351 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
352 * Compares two integers of type uint32_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
353 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
354 * @param i1 uint32_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
355 * @param i2 uint32_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
356 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
357 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
358 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
359 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
360 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
361 CX_EXPORT int cx_vcmp_uint32(uint32_t i1, uint32_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
362
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
363 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
364 * Compares two integers of type uint64_t.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
365 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
366 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
367 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
368 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
369 * @param i1 pointer to uint64_t one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
370 * @param i2 pointer to uint64_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
371 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
372 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
373 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
374 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
375 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
376 CX_EXPORT int cx_cmp_uint64(const void *i1, const void *i2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
377
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
378 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
379 * Compares two integers of type uint64_t.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
380 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
381 * @param i1 uint64_t one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
382 * @param i2 uint64_t two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
383 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
384 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
385 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
386 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
387 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
388 CX_EXPORT int cx_vcmp_uint64(uint64_t i1, uint64_t i2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
389
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
390 /**
1399
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
391 * Compares two integers of type size_t.
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
392 *
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
393 * @note the parameters deliberately have type @c void* to be
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
394 * compatible with #cx_compare_func without the need of a cast.
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
395 *
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
396 * @param i1 pointer to size_t one
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
397 * @param i2 pointer to size_t two
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
398 * @retval -1 if the left argument is less than the right argument
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
399 * @retval 0 if both arguments are equal
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
400 * @retval 1 if the left argument is greater than the right argument
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
401 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
402 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
403 CX_EXPORT int cx_cmp_size(const void *i1, const void *i2);
1399
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
404
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
405 /**
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
406 * Compares two integers of type size_t.
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
407 *
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
408 * @param i1 size_t one
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
409 * @param i2 size_t two
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
410 * @retval -1 if the left argument is less than the right argument
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
411 * @retval 0 if both arguments are equal
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
412 * @retval 1 if the left argument is greater than the right argument
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
413 */
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
414 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
415 CX_EXPORT int cx_vcmp_size(size_t i1, size_t i2);
1399
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
416
40c3b850f859 add size_t compare functions
Mike Becker <universe@uap-core.de>
parents: 1186
diff changeset
417 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
418 * Compares two real numbers of type float with precision 1e-6f.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
419 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
420 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
421 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
422 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
423 * @param f1 pointer to float one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
424 * @param f2 pointer to float two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
425 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
426 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
427 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
428 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
429 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
430 CX_EXPORT int cx_cmp_float(const void *f1, const void *f2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
431
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
432 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
433 * Compares two real numbers of type float with precision 1e-6f.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
434 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
435 * @param f1 float one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
436 * @param f2 float two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
437 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
438 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
439 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
440 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
441 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
442 CX_EXPORT int cx_vcmp_float(float f1, float f2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
443
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
444 /**
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
445 * Compares two real numbers of type double with precision 1e-14.
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
446 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
447 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
448 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
449 *
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
450 * @param d1 pointer to double one
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
451 * @param d2 pointer to double two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
452 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
453 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
454 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
455 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
456 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
457 CX_EXPORT int cx_cmp_double(const void *d1, const void *d2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
458
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
459 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
460 * Compares two real numbers of type double with precision 1e-14.
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
461 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
462 * @param d1 double one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
463 * @param d2 double two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
464 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
465 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
466 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
467 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
468 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
469 CX_EXPORT int cx_vcmp_double(double d1, double d2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
470
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
471 /**
631
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
472 * Compares the integer representation of two pointers.
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
473 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
474 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
475 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
476 *
890
54565fd74e74 move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents: 786
diff changeset
477 * @param ptr1 pointer to pointer one (const intptr_t*)
54565fd74e74 move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents: 786
diff changeset
478 * @param ptr2 pointer to pointer two (const intptr_t*)
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
479 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
480 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
481 * @retval 1 if the left argument is greater than the right argument
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
482 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
483 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
484 CX_EXPORT int cx_cmp_intptr(const void *ptr1, const void *ptr2);
631
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
485
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
486 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
487 * Compares the integer representation of two pointers.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
488 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
489 * @param ptr1 pointer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
490 * @param ptr2 pointer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
491 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
492 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
493 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
494 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
495 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
496 CX_EXPORT int cx_vcmp_intptr(intptr_t ptr1, intptr_t ptr2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
497
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
498 /**
631
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
499 * Compares the unsigned integer representation of two pointers.
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
500 *
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
501 * @note the parameters deliberately have type @c void* to be
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
502 * compatible with #cx_compare_func without the need of a cast.
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
503 *
890
54565fd74e74 move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents: 786
diff changeset
504 * @param ptr1 pointer to pointer one (const uintptr_t*)
54565fd74e74 move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents: 786
diff changeset
505 * @param ptr2 pointer to pointer two (const uintptr_t*)
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
506 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
507 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
508 * @retval 1 if the left argument is greater than the right argument
631
406376e64fd8 tests for compare functions
Mike Becker <universe@uap-core.de>
parents: 605
diff changeset
509 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
510 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
511 CX_EXPORT int cx_cmp_uintptr(const void *ptr1, const void *ptr2);
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
512
762
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
513 /**
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
514 * Compares the unsigned integer representation of two pointers.
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
515 *
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
516 * @param ptr1 pointer one
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
517 * @param ptr2 pointer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
518 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
519 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
520 * @retval 1 if the left argument is greater than the right argument
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
521 */
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
522 cx_attr_nodiscard
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
523 CX_EXPORT int cx_vcmp_uintptr(uintptr_t ptr1, uintptr_t ptr2);
1062
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
524
8baed9b38bc6 add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents: 985
diff changeset
525 /**
1186
7fc882813125 improve consistency in compare.h documentation
Mike Becker <universe@uap-core.de>
parents: 1181
diff changeset
526 * Compares the pointers specified in the arguments without dereferencing.
762
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
527 *
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
528 * @param ptr1 pointer one
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
529 * @param ptr2 pointer two
1092
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
530 * @retval -1 if the left argument is less than the right argument
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
531 * @retval 0 if both arguments are equal
8a35119d1f01 refine docs for compare.h - issue #548
Mike Becker <universe@uap-core.de>
parents: 1062
diff changeset
532 * @retval 1 if the left argument is greater than the right argument
762
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
533 */
1426
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
534 cx_attr_nonnull cx_attr_nodiscard
3a89b31f0724 clean up header files and adds support for comparing arbitrary strings with string.h functions
Mike Becker <universe@uap-core.de>
parents: 1424
diff changeset
535 CX_EXPORT int cx_cmp_ptr(const void *ptr1, const void *ptr2);
762
4523f6d42512 add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents: 759
diff changeset
536
1618
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
537 /**
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
538 * A @c cx_compare_func2 compatible wrapper for @c memcmp().
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
539 *
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
540 * @param ptr1 pointer one
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
541 * @param ptr2 pointer two
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
542 * @param n (@c size_t*) a pointer to the length
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
543 * @return the result of @c memcmp()
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
544 */
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
545 cx_attr_nonnull cx_attr_nodiscard
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
546 CX_EXPORT int cx_acmp_memcmp(const void *ptr1, const void *ptr2, void *n);
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
547
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
548 /** Wraps a compare function for cx_acmp_wrap. */
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
549 typedef struct {
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
550 /** The wrapped compare function */
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
551 cx_compare_func cmp;
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
552 } cx_compare_func_wrapper;
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
553
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
554 /**
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
555 * A @c cx_compare_func2 wrapper for a @c cx_compare_func().
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
556 *
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
557 * This is not strictly compatible with a @c cx_compare_func2 because
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
558 * ISO C does not define conversions between function and object pointers.
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
559 *
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
560 * But it works on all tested platforms to cast a pointer to this function to
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
561 * a @c cx_compare_func2.
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
562 *
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
563 * @param ptr1 pointer one
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
564 * @param ptr2 pointer two
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
565 * @param cmp_wrapper a pointer to a @c cx_compare_func_wrapper
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
566 * @return the result of the invoked compare function
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
567 * @see cx_compare_func_wrapper_s
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
568 */
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
569 cx_attr_nonnull cx_attr_nodiscard
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
570 CX_EXPORT int cx_acmp_wrap(const void *ptr1, const void *ptr2, void* cmp_wrapper);
ef7cab6eb131 huge refactoring of collections to add support for 3-arg compare functions
Mike Becker <universe@uap-core.de>
parents: 1426
diff changeset
571
601
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
572 #ifdef __cplusplus
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
573 } // extern "C"
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
574 #endif
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
575
95ba6014041b add compare functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
576 #endif //UCX_COMPARE_H

mercurial