ucx/cx/compare.h

changeset 845
f3ab28ed22e5
parent 471
063a9f29098c
child 870
e167cf006213
--- a/ucx/cx/compare.h	Mon Oct 13 21:07:59 2025 +0200
+++ b/ucx/cx/compare.h	Mon Oct 13 21:31:58 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