40 |
40 |
41 #ifdef __cplusplus |
41 #ifdef __cplusplus |
42 extern "C" { |
42 extern "C" { |
43 #endif |
43 #endif |
44 |
44 |
45 #ifndef CX_COMPARE_FUNC_DEFINED |
45 /** |
46 #define CX_COMPARE_FUNC_DEFINED |
46 * A comparator function comparing two arbitrary values. |
47 /** |
47 * |
48 * A comparator function comparing two collection elements. |
48 * All functions from compare.h with the cx_cmp prefix are |
49 */ |
49 * compatible with this signature and can be used as |
50 typedef int(*cx_compare_func)( |
50 * compare function for collections, or other implementations |
51 const void *left, |
51 * that need to be type-agnostic. |
52 const void *right |
52 * |
|
53 * For simple comparisons the cx_vcmp family of functions |
|
54 * can be used, but they are NOT compatible with this function |
|
55 * pointer. |
|
56 */ |
|
57 cx_attr_nonnull |
|
58 cx_attr_nodiscard |
|
59 typedef int (*cx_compare_func)( |
|
60 const void *left, |
|
61 const void *right |
53 ); |
62 ); |
54 #endif // CX_COMPARE_FUNC_DEFINED |
|
55 |
63 |
56 /** |
64 /** |
57 * Compares two integers of type int. |
65 * Compares two integers of type int. |
|
66 * |
|
67 * @note the parameters deliberately have type @c void* to be |
|
68 * compatible with #cx_compare_func without the need of a cast. |
58 * |
69 * |
59 * @param i1 pointer to integer one |
70 * @param i1 pointer to integer one |
60 * @param i2 pointer to integer two |
71 * @param i2 pointer to integer two |
61 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
72 * @retval -1 if the left argument is less than the right argument |
62 * 1 if *i1 is greater than *i2 |
73 * @retval 0 if both arguments are equal |
63 */ |
74 * @retval 1 if the left argument is greater than the right argument |
|
75 */ |
|
76 cx_attr_nonnull |
|
77 cx_attr_nodiscard |
64 int cx_cmp_int(const void *i1, const void *i2); |
78 int cx_cmp_int(const void *i1, const void *i2); |
65 |
79 |
66 /** |
80 /** |
|
81 * Compares two ints. |
|
82 * |
|
83 * @param i1 integer one |
|
84 * @param i2 integer two |
|
85 * @retval -1 if the left argument is less than the right argument |
|
86 * @retval 0 if both arguments are equal |
|
87 * @retval 1 if the left argument is greater than the right argument |
|
88 */ |
|
89 cx_attr_nodiscard |
|
90 int cx_vcmp_int(int i1, int i2); |
|
91 |
|
92 /** |
67 * Compares two integers of type long int. |
93 * Compares two integers of type long int. |
|
94 * |
|
95 * @note the parameters deliberately have type @c void* to be |
|
96 * compatible with #cx_compare_func without the need of a cast. |
68 * |
97 * |
69 * @param i1 pointer to long integer one |
98 * @param i1 pointer to long integer one |
70 * @param i2 pointer to long integer two |
99 * @param i2 pointer to long integer two |
71 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
100 * @retval -1 if the left argument is less than the right argument |
72 * 1 if *i1 is greater than *i2 |
101 * @retval 0 if both arguments are equal |
73 */ |
102 * @retval 1 if the left argument is greater than the right argument |
|
103 */ |
|
104 cx_attr_nonnull |
|
105 cx_attr_nodiscard |
74 int cx_cmp_longint(const void *i1, const void *i2); |
106 int cx_cmp_longint(const void *i1, const void *i2); |
75 |
107 |
76 /** |
108 /** |
|
109 * Compares two long ints. |
|
110 * |
|
111 * @param i1 long integer one |
|
112 * @param i2 long integer two |
|
113 * @retval -1 if the left argument is less than the right argument |
|
114 * @retval 0 if both arguments are equal |
|
115 * @retval 1 if the left argument is greater than the right argument |
|
116 */ |
|
117 cx_attr_nodiscard |
|
118 int cx_vcmp_longint(long int i1, long int i2); |
|
119 |
|
120 /** |
77 * Compares two integers of type long long. |
121 * Compares two integers of type long long. |
|
122 * |
|
123 * @note the parameters deliberately have type @c void* to be |
|
124 * compatible with #cx_compare_func without the need of a cast. |
78 * |
125 * |
79 * @param i1 pointer to long long one |
126 * @param i1 pointer to long long one |
80 * @param i2 pointer to long long two |
127 * @param i2 pointer to long long two |
81 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
128 * @retval -1 if the left argument is less than the right argument |
82 * 1 if *i1 is greater than *i2 |
129 * @retval 0 if both arguments are equal |
83 */ |
130 * @retval 1 if the left argument is greater than the right argument |
|
131 */ |
|
132 cx_attr_nonnull |
|
133 cx_attr_nodiscard |
84 int cx_cmp_longlong(const void *i1, const void *i2); |
134 int cx_cmp_longlong(const void *i1, const void *i2); |
85 |
135 |
86 /** |
136 /** |
|
137 * Compares twolong long ints. |
|
138 * |
|
139 * @param i1 long long int one |
|
140 * @param i2 long long int two |
|
141 * @retval -1 if the left argument is less than the right argument |
|
142 * @retval 0 if both arguments are equal |
|
143 * @retval 1 if the left argument is greater than the right argument |
|
144 */ |
|
145 cx_attr_nodiscard |
|
146 int cx_vcmp_longlong(long long int i1, long long int i2); |
|
147 |
|
148 /** |
87 * Compares two integers of type int16_t. |
149 * Compares two integers of type int16_t. |
|
150 * |
|
151 * @note the parameters deliberately have type @c void* to be |
|
152 * compatible with #cx_compare_func without the need of a cast. |
88 * |
153 * |
89 * @param i1 pointer to int16_t one |
154 * @param i1 pointer to int16_t one |
90 * @param i2 pointer to int16_t two |
155 * @param i2 pointer to int16_t two |
91 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
156 * @retval -1 if the left argument is less than the right argument |
92 * 1 if *i1 is greater than *i2 |
157 * @retval 0 if both arguments are equal |
93 */ |
158 * @retval 1 if the left argument is greater than the right argument |
|
159 */ |
|
160 cx_attr_nonnull |
|
161 cx_attr_nodiscard |
94 int cx_cmp_int16(const void *i1, const void *i2); |
162 int cx_cmp_int16(const void *i1, const void *i2); |
95 |
163 |
96 /** |
164 /** |
|
165 * Compares two integers of type int16_t. |
|
166 * |
|
167 * @param i1 int16_t one |
|
168 * @param i2 int16_t two |
|
169 * @retval -1 if the left argument is less than the right argument |
|
170 * @retval 0 if both arguments are equal |
|
171 * @retval 1 if the left argument is greater than the right argument |
|
172 */ |
|
173 cx_attr_nodiscard |
|
174 int cx_vcmp_int16(int16_t i1, int16_t i2); |
|
175 |
|
176 /** |
97 * Compares two integers of type int32_t. |
177 * Compares two integers of type int32_t. |
|
178 * |
|
179 * @note the parameters deliberately have type @c void* to be |
|
180 * compatible with #cx_compare_func without the need of a cast. |
98 * |
181 * |
99 * @param i1 pointer to int32_t one |
182 * @param i1 pointer to int32_t one |
100 * @param i2 pointer to int32_t two |
183 * @param i2 pointer to int32_t two |
101 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
184 * @retval -1 if the left argument is less than the right argument |
102 * 1 if *i1 is greater than *i2 |
185 * @retval 0 if both arguments are equal |
103 */ |
186 * @retval 1 if the left argument is greater than the right argument |
|
187 */ |
|
188 cx_attr_nonnull |
|
189 cx_attr_nodiscard |
104 int cx_cmp_int32(const void *i1, const void *i2); |
190 int cx_cmp_int32(const void *i1, const void *i2); |
105 |
191 |
106 /** |
192 /** |
|
193 * Compares two integers of type int32_t. |
|
194 * |
|
195 * @param i1 int32_t one |
|
196 * @param i2 int32_t two |
|
197 * @retval -1 if the left argument is less than the right argument |
|
198 * @retval 0 if both arguments are equal |
|
199 * @retval 1 if the left argument is greater than the right argument |
|
200 */ |
|
201 cx_attr_nodiscard |
|
202 int cx_vcmp_int32(int32_t i1, int32_t i2); |
|
203 |
|
204 /** |
107 * Compares two integers of type int64_t. |
205 * Compares two integers of type int64_t. |
|
206 * |
|
207 * @note the parameters deliberately have type @c void* to be |
|
208 * compatible with #cx_compare_func without the need of a cast. |
108 * |
209 * |
109 * @param i1 pointer to int64_t one |
210 * @param i1 pointer to int64_t one |
110 * @param i2 pointer to int64_t two |
211 * @param i2 pointer to int64_t two |
111 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
212 * @retval -1 if the left argument is less than the right argument |
112 * 1 if *i1 is greater than *i2 |
213 * @retval 0 if both arguments are equal |
113 */ |
214 * @retval 1 if the left argument is greater than the right argument |
|
215 */ |
|
216 cx_attr_nonnull |
|
217 cx_attr_nodiscard |
114 int cx_cmp_int64(const void *i1, const void *i2); |
218 int cx_cmp_int64(const void *i1, const void *i2); |
115 |
219 |
116 /** |
220 /** |
|
221 * Compares two integers of type int64_t. |
|
222 * |
|
223 * @param i1 int64_t one |
|
224 * @param i2 int64_t two |
|
225 * @retval -1 if the left argument is less than the right argument |
|
226 * @retval 0 if both arguments are equal |
|
227 * @retval 1 if the left argument is greater than the right argument |
|
228 */ |
|
229 cx_attr_nodiscard |
|
230 int cx_vcmp_int64(int64_t i1, int64_t i2); |
|
231 |
|
232 /** |
117 * Compares two integers of type unsigned int. |
233 * Compares two integers of type unsigned int. |
|
234 * |
|
235 * @note the parameters deliberately have type @c void* to be |
|
236 * compatible with #cx_compare_func without the need of a cast. |
118 * |
237 * |
119 * @param i1 pointer to unsigned integer one |
238 * @param i1 pointer to unsigned integer one |
120 * @param i2 pointer to unsigned integer two |
239 * @param i2 pointer to unsigned integer two |
121 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
240 * @retval -1 if the left argument is less than the right argument |
122 * 1 if *i1 is greater than *i2 |
241 * @retval 0 if both arguments are equal |
123 */ |
242 * @retval 1 if the left argument is greater than the right argument |
|
243 */ |
|
244 cx_attr_nonnull |
|
245 cx_attr_nodiscard |
124 int cx_cmp_uint(const void *i1, const void *i2); |
246 int cx_cmp_uint(const void *i1, const void *i2); |
125 |
247 |
126 /** |
248 /** |
|
249 * Compares two unsigned ints. |
|
250 * |
|
251 * @param i1 unsigned integer one |
|
252 * @param i2 unsigned integer two |
|
253 * @retval -1 if the left argument is less than the right argument |
|
254 * @retval 0 if both arguments are equal |
|
255 * @retval 1 if the left argument is greater than the right argument |
|
256 */ |
|
257 cx_attr_nodiscard |
|
258 int cx_vcmp_uint(unsigned int i1, unsigned int i2); |
|
259 |
|
260 /** |
127 * Compares two integers of type unsigned long int. |
261 * Compares two integers of type unsigned long int. |
|
262 * |
|
263 * @note the parameters deliberately have type @c void* to be |
|
264 * compatible with #cx_compare_func without the need of a cast. |
128 * |
265 * |
129 * @param i1 pointer to unsigned long integer one |
266 * @param i1 pointer to unsigned long integer one |
130 * @param i2 pointer to unsigned long integer two |
267 * @param i2 pointer to unsigned long integer two |
131 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
268 * @retval -1 if the left argument is less than the right argument |
132 * 1 if *i1 is greater than *i2 |
269 * @retval 0 if both arguments are equal |
133 */ |
270 * @retval 1 if the left argument is greater than the right argument |
|
271 */ |
|
272 cx_attr_nonnull |
|
273 cx_attr_nodiscard |
134 int cx_cmp_ulongint(const void *i1, const void *i2); |
274 int cx_cmp_ulongint(const void *i1, const void *i2); |
135 |
275 |
136 /** |
276 /** |
|
277 * Compares two unsigned long ints. |
|
278 * |
|
279 * @param i1 unsigned long integer one |
|
280 * @param i2 unsigned long integer two |
|
281 * @retval -1 if the left argument is less than the right argument |
|
282 * @retval 0 if both arguments are equal |
|
283 * @retval 1 if the left argument is greater than the right argument |
|
284 */ |
|
285 cx_attr_nodiscard |
|
286 int cx_vcmp_ulongint(unsigned long int i1, unsigned long int i2); |
|
287 |
|
288 /** |
137 * Compares two integers of type unsigned long long. |
289 * Compares two integers of type unsigned long long. |
|
290 * |
|
291 * @note the parameters deliberately have type @c void* to be |
|
292 * compatible with #cx_compare_func without the need of a cast. |
138 * |
293 * |
139 * @param i1 pointer to unsigned long long one |
294 * @param i1 pointer to unsigned long long one |
140 * @param i2 pointer to unsigned long long two |
295 * @param i2 pointer to unsigned long long two |
141 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
296 * @retval -1 if the left argument is less than the right argument |
142 * 1 if *i1 is greater than *i2 |
297 * @retval 0 if both arguments are equal |
143 */ |
298 * @retval 1 if the left argument is greater than the right argument |
|
299 */ |
|
300 cx_attr_nonnull |
|
301 cx_attr_nodiscard |
144 int cx_cmp_ulonglong(const void *i1, const void *i2); |
302 int cx_cmp_ulonglong(const void *i1, const void *i2); |
145 |
303 |
146 /** |
304 /** |
|
305 * Compares two unsigned long long ints. |
|
306 * |
|
307 * @param i1 unsigned long long one |
|
308 * @param i2 unsigned long long two |
|
309 * @retval -1 if the left argument is less than the right argument |
|
310 * @retval 0 if both arguments are equal |
|
311 * @retval 1 if the left argument is greater than the right argument |
|
312 */ |
|
313 cx_attr_nodiscard |
|
314 int cx_vcmp_ulonglong(unsigned long long int i1, unsigned long long int i2); |
|
315 |
|
316 /** |
147 * Compares two integers of type uint16_t. |
317 * Compares two integers of type uint16_t. |
|
318 * |
|
319 * @note the parameters deliberately have type @c void* to be |
|
320 * compatible with #cx_compare_func without the need of a cast. |
148 * |
321 * |
149 * @param i1 pointer to uint16_t one |
322 * @param i1 pointer to uint16_t one |
150 * @param i2 pointer to uint16_t two |
323 * @param i2 pointer to uint16_t two |
151 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
324 * @retval -1 if the left argument is less than the right argument |
152 * 1 if *i1 is greater than *i2 |
325 * @retval 0 if both arguments are equal |
153 */ |
326 * @retval 1 if the left argument is greater than the right argument |
|
327 */ |
|
328 cx_attr_nonnull |
|
329 cx_attr_nodiscard |
154 int cx_cmp_uint16(const void *i1, const void *i2); |
330 int cx_cmp_uint16(const void *i1, const void *i2); |
155 |
331 |
156 /** |
332 /** |
|
333 * Compares two integers of type uint16_t. |
|
334 * |
|
335 * @param i1 uint16_t one |
|
336 * @param i2 uint16_t two |
|
337 * @retval -1 if the left argument is less than the right argument |
|
338 * @retval 0 if both arguments are equal |
|
339 * @retval 1 if the left argument is greater than the right argument |
|
340 */ |
|
341 cx_attr_nodiscard |
|
342 int cx_vcmp_uint16(uint16_t i1, uint16_t i2); |
|
343 |
|
344 /** |
157 * Compares two integers of type uint32_t. |
345 * Compares two integers of type uint32_t. |
|
346 * |
|
347 * @note the parameters deliberately have type @c void* to be |
|
348 * compatible with #cx_compare_func without the need of a cast. |
158 * |
349 * |
159 * @param i1 pointer to uint32_t one |
350 * @param i1 pointer to uint32_t one |
160 * @param i2 pointer to uint32_t two |
351 * @param i2 pointer to uint32_t two |
161 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
352 * @retval -1 if the left argument is less than the right argument |
162 * 1 if *i1 is greater than *i2 |
353 * @retval 0 if both arguments are equal |
163 */ |
354 * @retval 1 if the left argument is greater than the right argument |
|
355 */ |
|
356 cx_attr_nonnull |
|
357 cx_attr_nodiscard |
164 int cx_cmp_uint32(const void *i1, const void *i2); |
358 int cx_cmp_uint32(const void *i1, const void *i2); |
165 |
359 |
166 /** |
360 /** |
|
361 * Compares two integers of type uint32_t. |
|
362 * |
|
363 * @param i1 uint32_t one |
|
364 * @param i2 uint32_t two |
|
365 * @retval -1 if the left argument is less than the right argument |
|
366 * @retval 0 if both arguments are equal |
|
367 * @retval 1 if the left argument is greater than the right argument |
|
368 */ |
|
369 cx_attr_nodiscard |
|
370 int cx_vcmp_uint32(uint32_t i1, uint32_t i2); |
|
371 |
|
372 /** |
167 * Compares two integers of type uint64_t. |
373 * Compares two integers of type uint64_t. |
|
374 * |
|
375 * @note the parameters deliberately have type @c void* to be |
|
376 * compatible with #cx_compare_func without the need of a cast. |
168 * |
377 * |
169 * @param i1 pointer to uint64_t one |
378 * @param i1 pointer to uint64_t one |
170 * @param i2 pointer to uint64_t two |
379 * @param i2 pointer to uint64_t two |
171 * @return -1, if *i1 is less than *i2, 0 if both are equal, |
380 * @retval -1 if the left argument is less than the right argument |
172 * 1 if *i1 is greater than *i2 |
381 * @retval 0 if both arguments are equal |
173 */ |
382 * @retval 1 if the left argument is greater than the right argument |
|
383 */ |
|
384 cx_attr_nonnull |
|
385 cx_attr_nodiscard |
174 int cx_cmp_uint64(const void *i1, const void *i2); |
386 int cx_cmp_uint64(const void *i1, const void *i2); |
175 |
387 |
176 /** |
388 /** |
|
389 * Compares two integers of type uint64_t. |
|
390 * |
|
391 * @param i1 uint64_t one |
|
392 * @param i2 uint64_t two |
|
393 * @retval -1 if the left argument is less than the right argument |
|
394 * @retval 0 if both arguments are equal |
|
395 * @retval 1 if the left argument is greater than the right argument |
|
396 */ |
|
397 cx_attr_nodiscard |
|
398 int cx_vcmp_uint64(uint64_t i1, uint64_t i2); |
|
399 |
|
400 /** |
177 * Compares two real numbers of type float with precision 1e-6f. |
401 * Compares two real numbers of type float with precision 1e-6f. |
|
402 * |
|
403 * @note the parameters deliberately have type @c void* to be |
|
404 * compatible with #cx_compare_func without the need of a cast. |
178 * |
405 * |
179 * @param f1 pointer to float one |
406 * @param f1 pointer to float one |
180 * @param f2 pointer to float two |
407 * @param f2 pointer to float two |
181 * @return -1, if *f1 is less than *f2, 0 if both are equal, |
408 * @retval -1 if the left argument is less than the right argument |
182 * 1 if *f1 is greater than *f2 |
409 * @retval 0 if both arguments are equal |
183 */ |
410 * @retval 1 if the left argument is greater than the right argument |
184 |
411 */ |
|
412 cx_attr_nonnull |
|
413 cx_attr_nodiscard |
185 int cx_cmp_float(const void *f1, const void *f2); |
414 int cx_cmp_float(const void *f1, const void *f2); |
186 |
415 |
187 /** |
416 /** |
|
417 * Compares two real numbers of type float with precision 1e-6f. |
|
418 * |
|
419 * @param f1 float one |
|
420 * @param f2 float two |
|
421 * @retval -1 if the left argument is less than the right argument |
|
422 * @retval 0 if both arguments are equal |
|
423 * @retval 1 if the left argument is greater than the right argument |
|
424 */ |
|
425 cx_attr_nodiscard |
|
426 int cx_vcmp_float(float f1, float f2); |
|
427 |
|
428 /** |
188 * Compares two real numbers of type double with precision 1e-14. |
429 * Compares two real numbers of type double with precision 1e-14. |
|
430 * |
|
431 * @note the parameters deliberately have type @c void* to be |
|
432 * compatible with #cx_compare_func without the need of a cast. |
189 * |
433 * |
190 * @param d1 pointer to double one |
434 * @param d1 pointer to double one |
191 * @param d2 pointer to double two |
435 * @param d2 pointer to double two |
192 * @return -1, if *d1 is less than *d2, 0 if both are equal, |
436 * @retval -1 if the left argument is less than the right argument |
193 * 1 if *d1 is greater than *d2 |
437 * @retval 0 if both arguments are equal |
194 */ |
438 * @retval 1 if the left argument is greater than the right argument |
195 int cx_cmp_double( |
439 */ |
196 const void *d1, |
440 cx_attr_nonnull |
197 const void *d2 |
441 cx_attr_nodiscard |
198 ); |
442 int cx_cmp_double(const void *d1, const void *d2); |
|
443 |
|
444 /** |
|
445 * Convenience function |
|
446 * |
|
447 * @param d1 double one |
|
448 * @param d2 double two |
|
449 * @retval -1 if the left argument is less than the right argument |
|
450 * @retval 0 if both arguments are equal |
|
451 * @retval 1 if the left argument is greater than the right argument |
|
452 */ |
|
453 cx_attr_nodiscard |
|
454 int cx_vcmp_double(double d1, double d2); |
199 |
455 |
200 /** |
456 /** |
201 * Compares the integer representation of two pointers. |
457 * Compares the integer representation of two pointers. |
|
458 * |
|
459 * @note the parameters deliberately have type @c void* to be |
|
460 * compatible with #cx_compare_func without the need of a cast. |
202 * |
461 * |
203 * @param ptr1 pointer to pointer one (const intptr_t*) |
462 * @param ptr1 pointer to pointer one (const intptr_t*) |
204 * @param ptr2 pointer to pointer two (const intptr_t*) |
463 * @param ptr2 pointer to pointer two (const intptr_t*) |
205 * @return -1 if *ptr1 is less than *ptr2, 0 if both are equal, |
464 * @retval -1 if the left argument is less than the right argument |
206 * 1 if *ptr1 is greater than *ptr2 |
465 * @retval 0 if both arguments are equal |
207 */ |
466 * @retval 1 if the left argument is greater than the right argument |
208 int cx_cmp_intptr( |
467 */ |
209 const void *ptr1, |
468 cx_attr_nonnull |
210 const void *ptr2 |
469 cx_attr_nodiscard |
211 ); |
470 int cx_cmp_intptr(const void *ptr1, const void *ptr2); |
|
471 |
|
472 /** |
|
473 * Compares the integer representation of two pointers. |
|
474 * |
|
475 * @param ptr1 pointer one |
|
476 * @param ptr2 pointer two |
|
477 * @retval -1 if the left argument is less than the right argument |
|
478 * @retval 0 if both arguments are equal |
|
479 * @retval 1 if the left argument is greater than the right argument |
|
480 */ |
|
481 cx_attr_nodiscard |
|
482 int cx_vcmp_intptr(intptr_t ptr1, intptr_t ptr2); |
212 |
483 |
213 /** |
484 /** |
214 * Compares the unsigned integer representation of two pointers. |
485 * Compares the unsigned integer representation of two pointers. |
|
486 * |
|
487 * @note the parameters deliberately have type @c void* to be |
|
488 * compatible with #cx_compare_func without the need of a cast. |
215 * |
489 * |
216 * @param ptr1 pointer to pointer one (const uintptr_t*) |
490 * @param ptr1 pointer to pointer one (const uintptr_t*) |
217 * @param ptr2 pointer to pointer two (const uintptr_t*) |
491 * @param ptr2 pointer to pointer two (const uintptr_t*) |
218 * @return -1 if *ptr1 is less than *ptr2, 0 if both are equal, |
492 * @retval -1 if the left argument is less than the right argument |
219 * 1 if *ptr1 is greater than *ptr2 |
493 * @retval 0 if both arguments are equal |
220 */ |
494 * @retval 1 if the left argument is greater than the right argument |
221 int cx_cmp_uintptr( |
495 */ |
222 const void *ptr1, |
496 cx_attr_nonnull |
223 const void *ptr2 |
497 cx_attr_nodiscard |
224 ); |
498 int cx_cmp_uintptr(const void *ptr1, const void *ptr2); |
225 |
499 |
226 /** |
500 /** |
227 * Compares the pointers specified in the arguments without de-referencing. |
501 * Compares the unsigned integer representation of two pointers. |
228 * |
502 * |
229 * @param ptr1 pointer one |
503 * @param ptr1 pointer one |
230 * @param ptr2 pointer two |
504 * @param ptr2 pointer two |
231 * @return -1 if ptr1 is less than ptr2, 0 if both are equal, |
505 * @retval -1 if the left argument is less than the right argument |
232 * 1 if ptr1 is greater than ptr2 |
506 * @retval 0 if both arguments are equal |
233 */ |
507 * @retval 1 if the left argument is greater than the right argument |
234 int cx_cmp_ptr( |
508 */ |
235 const void *ptr1, |
509 cx_attr_nodiscard |
236 const void *ptr2 |
510 int cx_vcmp_uintptr(uintptr_t ptr1, uintptr_t ptr2); |
237 ); |
511 |
|
512 /** |
|
513 * Compares the pointers specified in the arguments without de-referencing. |
|
514 * |
|
515 * @param ptr1 pointer one |
|
516 * @param ptr2 pointer two |
|
517 * @retval -1 if the left argument is less than the right argument |
|
518 * @retval 0 if both arguments are equal |
|
519 * @retval 1 if the left argument is greater than the right argument |
|
520 */ |
|
521 cx_attr_nonnull |
|
522 cx_attr_nodiscard |
|
523 int cx_cmp_ptr(const void *ptr1, const void *ptr2); |
238 |
524 |
239 #ifdef __cplusplus |
525 #ifdef __cplusplus |
240 } // extern "C" |
526 } // extern "C" |
241 #endif |
527 #endif |
242 |
528 |