ucx/cx/compare.h

branch
newapi
changeset 253
087cc9216f28
parent 174
0358f1d9c506
--- a/ucx/cx/compare.h	Sun Feb 11 15:44:33 2024 +0100
+++ b/ucx/cx/compare.h	Sun Feb 11 22:06:23 2024 +0100
@@ -30,7 +30,6 @@
  * \brief A collection of simple compare functions.
  * \author Mike Becker
  * \author Olaf Wintermann
- * \version 3.0
  * \copyright 2-Clause BSD License
  */
 
@@ -43,6 +42,17 @@
 extern "C" {
 #endif
 
+#ifndef CX_COMPARE_FUNC_DEFINED
+#define CX_COMPARE_FUNC_DEFINED
+/**
+ * A comparator function comparing two collection elements.
+ */
+typedef int(*cx_compare_func)(
+        void const *left,
+        void const *right
+);
+#endif // CX_COMPARE_FUNC_DEFINED
+
 /**
  * Compares two integers of type int.
  *
@@ -213,6 +223,19 @@
         void const *ptr2
 );
 
+/**
+ * Compares the pointers specified in the arguments without de-referencing.
+ *
+ * @param ptr1 pointer one
+ * @param ptr2 pointer two
+ * @return -1 if ptr1 is less than ptr2, 0 if both are equal,
+ * 1 if ptr1 is greater than ptr2
+ */
+int cx_cmp_ptr(
+        void const *ptr1,
+        void const *ptr2
+);
+
 #ifdef __cplusplus
 } // extern "C"
 #endif

mercurial