Sat, 28 Dec 2024 17:31:28 +0100
add cx_vcmp_* family of functions
fixes #538
601 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | /** | |
29 | * \file compare.h | |
30 | * \brief A collection of simple compare functions. | |
31 | * \author Mike Becker | |
32 | * \author Olaf Wintermann | |
33 | * \copyright 2-Clause BSD License | |
34 | */ | |
35 | ||
36 | #ifndef UCX_COMPARE_H | |
37 | #define UCX_COMPARE_H | |
38 | ||
650
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 | 41 | #ifdef __cplusplus |
42 | extern "C" { | |
43 | #endif | |
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 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
50 | * compare function for collections, or other implementations |
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 | */ |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
57 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
58 | cx_attr_nodiscard |
786
b0ebb3d88407
declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents:
762
diff
changeset
|
59 | typedef int(*cx_compare_func)( |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
60 | const void *left, |
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
61 | const void *right |
786
b0ebb3d88407
declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents:
762
diff
changeset
|
62 | ); |
b0ebb3d88407
declare cx_compare_func in compare.h - fixes #344
Mike Becker <universe@uap-core.de>
parents:
762
diff
changeset
|
63 | |
601 | 64 | /** |
65 | * Compares two integers of type int. | |
66 | * | |
67 | * @param i1 pointer to integer one | |
68 | * @param i2 pointer to integer two | |
69 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
70 | * 1 if *i1 is greater than *i2 | |
71 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
72 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
73 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
74 | int cx_cmp_int(const void *i1, const void *i2); |
601 | 75 | |
76 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
77 | * Compares two ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
78 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
79 | * @param i1 integer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
80 | * @param i2 integer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
81 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
82 | * 1 if i1 is greater than i2 |
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 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
85 | int cx_vcmp_int(int i1, int i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
86 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
87 | /** |
601 | 88 | * Compares two integers of type long int. |
89 | * | |
90 | * @param i1 pointer to long integer one | |
91 | * @param i2 pointer to long integer two | |
92 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
93 | * 1 if *i1 is greater than *i2 | |
94 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
95 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
96 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
97 | int cx_cmp_longint(const void *i1, const void *i2); |
601 | 98 | |
99 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
100 | * Compares two long ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
101 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
102 | * @param i1 long integer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
103 | * @param i2 long integer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
104 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
105 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
106 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
107 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
108 | int cx_vcmp_longint(long int i1, long int i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
109 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
110 | /** |
601 | 111 | * Compares two integers of type long long. |
112 | * | |
113 | * @param i1 pointer to long long one | |
114 | * @param i2 pointer to long long two | |
115 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
116 | * 1 if *i1 is greater than *i2 | |
117 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
118 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
119 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
120 | int cx_cmp_longlong(const void *i1, const void *i2); |
601 | 121 | |
122 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
123 | * Compares twolong long ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
124 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
125 | * @param i1 long long int one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
126 | * @param i2 long long int two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
127 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
128 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
129 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
130 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
131 | int cx_vcmp_longlong(long long int i1, long long int i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
132 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
133 | /** |
601 | 134 | * Compares two integers of type int16_t. |
135 | * | |
136 | * @param i1 pointer to int16_t one | |
137 | * @param i2 pointer to int16_t two | |
138 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
139 | * 1 if *i1 is greater than *i2 | |
140 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
141 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
142 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
143 | int cx_cmp_int16(const void *i1, const void *i2); |
601 | 144 | |
145 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
146 | * Compares two integers of type int16_t. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
147 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
148 | * @param i1 int16_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
149 | * @param i2 int16_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
150 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
151 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
152 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
153 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
154 | int cx_vcmp_int16(int16_t i1, int16_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
155 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
156 | /** |
601 | 157 | * Compares two integers of type int32_t. |
158 | * | |
159 | * @param i1 pointer to int32_t one | |
160 | * @param i2 pointer to int32_t two | |
161 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
162 | * 1 if *i1 is greater than *i2 | |
163 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
164 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
165 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
166 | int cx_cmp_int32(const void *i1, const void *i2); |
601 | 167 | |
168 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
169 | * Compares two integers of type int32_t. |
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 | * @param i1 int32_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
172 | * @param i2 int32_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
173 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
174 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
175 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
176 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
177 | int cx_vcmp_int32(int32_t i1, int32_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
178 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
179 | /** |
601 | 180 | * Compares two integers of type int64_t. |
181 | * | |
182 | * @param i1 pointer to int64_t one | |
183 | * @param i2 pointer to int64_t two | |
184 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
185 | * 1 if *i1 is greater than *i2 | |
186 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
187 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
188 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
189 | int cx_cmp_int64(const void *i1, const void *i2); |
601 | 190 | |
191 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
192 | * Compares two integers of type int64_t. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
193 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
194 | * @param i1 int64_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
195 | * @param i2 int64_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
196 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
197 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
198 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
199 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
200 | int cx_vcmp_int64(int64_t i1, int64_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
201 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
202 | /** |
601 | 203 | * Compares two integers of type unsigned int. |
204 | * | |
205 | * @param i1 pointer to unsigned integer one | |
206 | * @param i2 pointer to unsigned integer two | |
207 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
208 | * 1 if *i1 is greater than *i2 | |
209 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
210 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
211 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
212 | int cx_cmp_uint(const void *i1, const void *i2); |
601 | 213 | |
214 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
215 | * Compares two unsigned ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
216 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
217 | * @param i1 unsigned integer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
218 | * @param i2 unsigned integer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
219 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
220 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
221 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
222 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
223 | int cx_vcmp_uint(unsigned int i1, unsigned int i2); |
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 | /** |
601 | 226 | * Compares two integers of type unsigned long int. |
227 | * | |
228 | * @param i1 pointer to unsigned long integer one | |
229 | * @param i2 pointer to unsigned long integer two | |
230 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
231 | * 1 if *i1 is greater than *i2 | |
232 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
233 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
234 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
235 | int cx_cmp_ulongint(const void *i1, const void *i2); |
601 | 236 | |
237 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
238 | * Compares two unsigned long ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
239 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
240 | * @param i1 unsigned long integer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
241 | * @param i2 unsigned long integer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
242 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
243 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
244 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
245 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
246 | int cx_vcmp_ulongint(unsigned long int i1, unsigned long int i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
247 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
248 | /** |
601 | 249 | * Compares two integers of type unsigned long long. |
250 | * | |
251 | * @param i1 pointer to unsigned long long one | |
252 | * @param i2 pointer to unsigned long long two | |
253 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
254 | * 1 if *i1 is greater than *i2 | |
255 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
256 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
257 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
258 | int cx_cmp_ulonglong(const void *i1, const void *i2); |
601 | 259 | |
260 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
261 | * Compares two unsigned long long ints. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
262 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
263 | * @param i1 unsigned long long one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
264 | * @param i2 unsigned long long two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
265 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
266 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
267 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
268 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
269 | int cx_vcmp_ulonglong(unsigned long long int i1, unsigned long long int i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
270 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
271 | /** |
601 | 272 | * Compares two integers of type uint16_t. |
273 | * | |
274 | * @param i1 pointer to uint16_t one | |
275 | * @param i2 pointer to uint16_t two | |
276 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
277 | * 1 if *i1 is greater than *i2 | |
278 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
279 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
280 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
281 | int cx_cmp_uint16(const void *i1, const void *i2); |
601 | 282 | |
283 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
284 | * Compares two integers of type uint16_t. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
285 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
286 | * @param i1 uint16_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
287 | * @param i2 uint16_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
288 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
289 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
290 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
291 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
292 | int cx_vcmp_uint16(uint16_t i1, uint16_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
293 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
294 | /** |
601 | 295 | * Compares two integers of type uint32_t. |
296 | * | |
297 | * @param i1 pointer to uint32_t one | |
298 | * @param i2 pointer to uint32_t two | |
299 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
300 | * 1 if *i1 is greater than *i2 | |
301 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
302 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
303 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
304 | int cx_cmp_uint32(const void *i1, const void *i2); |
601 | 305 | |
306 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
307 | * Compares two integers of type uint32_t. |
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 | * @param i1 uint32_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
310 | * @param i2 uint32_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
311 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
312 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
313 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
314 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
315 | int cx_vcmp_uint32(uint32_t i1, uint32_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
316 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
317 | /** |
601 | 318 | * Compares two integers of type uint64_t. |
319 | * | |
320 | * @param i1 pointer to uint64_t one | |
321 | * @param i2 pointer to uint64_t two | |
322 | * @return -1, if *i1 is less than *i2, 0 if both are equal, | |
323 | * 1 if *i1 is greater than *i2 | |
324 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
325 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
326 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
327 | int cx_cmp_uint64(const void *i1, const void *i2); |
601 | 328 | |
329 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
330 | * Compares two integers of type uint64_t. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
331 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
332 | * @param i1 uint64_t one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
333 | * @param i2 uint64_t two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
334 | * @return -1, if i1 is less than i2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
335 | * 1 if i1 is greater than i2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
336 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
337 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
338 | int cx_vcmp_uint64(uint64_t i1, uint64_t i2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
339 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
340 | /** |
601 | 341 | * Compares two real numbers of type float with precision 1e-6f. |
342 | * | |
343 | * @param f1 pointer to float one | |
344 | * @param f2 pointer to float two | |
345 | * @return -1, if *f1 is less than *f2, 0 if both are equal, | |
346 | * 1 if *f1 is greater than *f2 | |
347 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
348 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
349 | cx_attr_nodiscard |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
350 | int cx_cmp_float(const void *f1, const void *f2); |
601 | 351 | |
352 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
353 | * 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
|
354 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
355 | * @param f1 float one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
356 | * @param f2 float two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
357 | * @return -1, if f1 is less than f2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
358 | * 1 if f1 is greater than f2 |
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 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
361 | int cx_vcmp_float(float f1, float f2); |
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 | 364 | * Compares two real numbers of type double with precision 1e-14. |
365 | * | |
366 | * @param d1 pointer to double one | |
367 | * @param d2 pointer to double two | |
368 | * @return -1, if *d1 is less than *d2, 0 if both are equal, | |
369 | * 1 if *d1 is greater than *d2 | |
370 | */ | |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
371 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
372 | cx_attr_nodiscard |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
373 | int cx_cmp_double(const void *d1, const void *d2); |
601 | 374 | |
375 | /** | |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
376 | * Convenience function |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
377 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
378 | * @param d1 double one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
379 | * @param d2 double two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
380 | * @return -1, if d1 is less than d2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
381 | * 1 if d1 is greater than d2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
382 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
383 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
384 | int cx_vcmp_double(double d1, double d2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
385 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
386 | /** |
631
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
387 | * Compares the integer representation of two pointers. |
601 | 388 | * |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
389 | * @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
|
390 | * @param ptr2 pointer to pointer two (const intptr_t*) |
631
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
391 | * @return -1 if *ptr1 is less than *ptr2, 0 if both are equal, |
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
392 | * 1 if *ptr1 is greater than *ptr2 |
601 | 393 | */ |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
394 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
395 | cx_attr_nodiscard |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
396 | 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
|
397 | |
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
398 | /** |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
399 | * Compares the integer representation of two pointers. |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
400 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
401 | * @param ptr1 pointer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
402 | * @param ptr2 pointer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
403 | * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
404 | * 1 if ptr1 is greater than ptr2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
405 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
406 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
407 | int cx_vcmp_intptr(intptr_t ptr1, intptr_t ptr2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
408 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
409 | /** |
631
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
410 | * Compares the unsigned integer representation of two pointers. |
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
411 | * |
890
54565fd74e74
move all const keywords to the west - fixes #426
Mike Becker <universe@uap-core.de>
parents:
786
diff
changeset
|
412 | * @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
|
413 | * @param ptr2 pointer to pointer two (const uintptr_t*) |
631
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
414 | * @return -1 if *ptr1 is less than *ptr2, 0 if both are equal, |
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
415 | * 1 if *ptr1 is greater than *ptr2 |
406376e64fd8
tests for compare functions
Mike Becker <universe@uap-core.de>
parents:
605
diff
changeset
|
416 | */ |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
417 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
418 | cx_attr_nodiscard |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
419 | int cx_cmp_uintptr(const void *ptr1, const void *ptr2); |
601 | 420 | |
762
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
421 | /** |
1062
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
422 | * 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
|
423 | * |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
424 | * @param ptr1 pointer one |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
425 | * @param ptr2 pointer two |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
426 | * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
427 | * 1 if ptr1 is greater than ptr2 |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
428 | */ |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
429 | cx_attr_nodiscard |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
430 | int cx_vcmp_uintptr(uintptr_t ptr1, uintptr_t ptr2); |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
431 | |
8baed9b38bc6
add cx_vcmp_* family of functions
Mike Becker <universe@uap-core.de>
parents:
985
diff
changeset
|
432 | /** |
762
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
433 | * Compares the pointers specified in the arguments without de-referencing. |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
434 | * |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
435 | * @param ptr1 pointer one |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
436 | * @param ptr2 pointer two |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
437 | * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
438 | * 1 if ptr1 is greater than ptr2 |
4523f6d42512
add cx_cmp_ptr() - fix #340
Mike Becker <universe@uap-core.de>
parents:
759
diff
changeset
|
439 | */ |
985
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
440 | cx_attr_nonnull |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
441 | cx_attr_nodiscard |
68754c7de906
major refactoring of attributes
Mike Becker <universe@uap-core.de>
parents:
890
diff
changeset
|
442 | 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
|
443 | |
601 | 444 | #ifdef __cplusplus |
445 | } // extern "C" | |
446 | #endif | |
447 | ||
448 | #endif //UCX_COMPARE_H |