summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sys/avl.h7
-rw-r--r--include/sys/zfs_context.h1
2 files changed, 8 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.
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index 4a65600c1..bc5087551 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -131,6 +131,7 @@
*/
#define noinline __attribute__((noinline))
+#define likely(x) __builtin_expect((x), 1)
/*
* Debugging