ucx/cx/compare.h

changeset 112
c3f2f16fa4b8
parent 102
64ded9f6a6c6
child 113
dde28a806552
--- a/ucx/cx/compare.h	Sat Oct 04 14:54:25 2025 +0200
+++ b/ucx/cx/compare.h	Sun Oct 19 21:20:08 2025 +0200
@@ -47,7 +47,7 @@
  *
  * All functions from compare.h with the cx_cmp prefix are
  * compatible with this signature and can be used as
- * compare function for collections, or other implementations
+ * compare function for collections or other implementations
  * that need to be type-agnostic.
  *
  * For simple comparisons the cx_vcmp family of functions
@@ -423,6 +423,36 @@
 int cx_vcmp_uint64(uint64_t i1, uint64_t i2);
 
 /**
+ * Compares two integers of type size_t.
+ *
+ * @note the parameters deliberately have type @c void* to be
+ * compatible with #cx_compare_func without the need of a cast.
+ *
+ * @param i1 pointer to size_t one
+ * @param i2 pointer to size_t two
+ * @retval -1 if the left argument is less than the right argument
+ * @retval 0 if both arguments are equal
+ * @retval 1 if the left argument is greater than the right argument
+ */
+cx_attr_nonnull
+cx_attr_nodiscard
+cx_attr_export
+int cx_cmp_size(const void *i1, const void *i2);
+
+/**
+ * Compares two integers of type size_t.
+ *
+ * @param i1 size_t one
+ * @param i2 size_t two
+ * @retval -1 if the left argument is less than the right argument
+ * @retval 0 if both arguments are equal
+ * @retval 1 if the left argument is greater than the right argument
+ */
+cx_attr_nodiscard
+cx_attr_export
+int cx_vcmp_size(size_t i1, size_t i2);
+
+/**
  * Compares two real numbers of type float with precision 1e-6f.
  *
  * @note the parameters deliberately have type @c void* to be

mercurial