aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/avl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys/avl.h')
-rw-r--r--include/sys/avl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sys/avl.h b/include/sys/avl.h
index 10e0ddaee..ba51e2a79 100644
--- a/include/sys/avl.h
+++ b/include/sys/avl.h
@@ -105,6 +105,13 @@ extern "C" {
* as is needed for any linked list implementation.
*/
+/*
+ * AVL comparator helpers
+ */
+#define AVL_ISIGN(a) (((a) > 0) - ((a) < 0))
+#define AVL_CMP(a, b) (((a) > (b)) - ((a) < (b)))
+#define AVL_PCMP(a, b) \
+ (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b)))
/*
* Type used for the root of the AVL tree.