aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-26 22:33:32 -0400
committerIan Moffett <ian@osmora.org>2024-04-26 22:33:32 -0400
commit00f779ab42468ce761d65a44f61c3e28212ef4d2 (patch)
tree1a83880a485cb8aaa08b704aa2bc9f7588241c8d
parent619e2ce58cce811fc14d6dc011d2cf5f12c12b85 (diff)
kernel: cdefs: Add __likely() and __unlikely()
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/include/sys/cdefs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/include/sys/cdefs.h b/sys/include/sys/cdefs.h
index 152765c..110205b 100644
--- a/sys/include/sys/cdefs.h
+++ b/sys/include/sys/cdefs.h
@@ -39,6 +39,9 @@
#define __naked __attr(naked)
#define __noreturn __attr(noreturn)
+#define __likely(x) __builtin_expect(!!(x), 1)
+#define __unlikely(x) __builtin_expect(!!(x), 0)
+
/* Wrapper for inline asm */
#define __ASMV __asm__ __volatile__