commit 788f36ae124cfa1d4d005411ae8ea74d019cb75b
parent dfce8a98479c80a98ce8c1017394c7f2d93e4814
Author: robert <robertrussell.72001@gmail.com>
Date: Fri, 19 Aug 2022 18:01:36 -0700
Add GCC branch predition hint macros
Probably will want these for hash functions (to be implemented)
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/inc/cext/def.h b/inc/cext/def.h
@@ -12,8 +12,12 @@
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
+#define likely(x) __builtin_expect((x), 1)
+#define unlikely(x) __builtin_expect((x), 0)
#else
#define UNUSED
+#define likely(x) (x)
+#define unlikely(x) (x)
#endif
typedef unsigned char uchar;