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