ucx/cx/compare.h

changeset 112
c3f2f16fa4b8
parent 102
64ded9f6a6c6
child 113
dde28a806552
equal deleted inserted replaced
111:81c4f73236a4 112:c3f2f16fa4b8
45 /** 45 /**
46 * A comparator function comparing two arbitrary values. 46 * A comparator function comparing two arbitrary values.
47 * 47 *
48 * All functions from compare.h with the cx_cmp prefix are 48 * All functions from compare.h with the cx_cmp prefix are
49 * compatible with this signature and can be used as 49 * compatible with this signature and can be used as
50 * compare function for collections, or other implementations 50 * compare function for collections or other implementations
51 * that need to be type-agnostic. 51 * that need to be type-agnostic.
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.
421 cx_attr_nodiscard 421 cx_attr_nodiscard
422 cx_attr_export 422 cx_attr_export
423 int cx_vcmp_uint64(uint64_t i1, uint64_t i2); 423 int cx_vcmp_uint64(uint64_t i1, uint64_t i2);
424 424
425 /** 425 /**
426 * Compares two integers of type size_t.
427 *
428 * @note the parameters deliberately have type @c void* to be
429 * compatible with #cx_compare_func without the need of a cast.
430 *
431 * @param i1 pointer to size_t one
432 * @param i2 pointer to size_t two
433 * @retval -1 if the left argument is less than the right argument
434 * @retval 0 if both arguments are equal
435 * @retval 1 if the left argument is greater than the right argument
436 */
437 cx_attr_nonnull
438 cx_attr_nodiscard
439 cx_attr_export
440 int cx_cmp_size(const void *i1, const void *i2);
441
442 /**
443 * Compares two integers of type size_t.
444 *
445 * @param i1 size_t one
446 * @param i2 size_t two
447 * @retval -1 if the left argument is less than the right argument
448 * @retval 0 if both arguments are equal
449 * @retval 1 if the left argument is greater than the right argument
450 */
451 cx_attr_nodiscard
452 cx_attr_export
453 int cx_vcmp_size(size_t i1, size_t i2);
454
455 /**
426 * Compares two real numbers of type float with precision 1e-6f. 456 * Compares two real numbers of type float with precision 1e-6f.
427 * 457 *
428 * @note the parameters deliberately have type @c void* to be 458 * @note the parameters deliberately have type @c void* to be
429 * compatible with #cx_compare_func without the need of a cast. 459 * compatible with #cx_compare_func without the need of a cast.
430 * 460 *

mercurial