summaryrefslogtreecommitdiff
path: root/src/mesa/main/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/compiler.h')
-rw-r--r--src/mesa/main/compiler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 81704ae2c1..efd8057608 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -200,6 +200,13 @@ extern "C" {
# define __builtin_expect(x, y) x
#endif
+#ifdef __GNUC__
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) !!(x)
+#define unlikely(x) !!(x)
+#endif
/**
* The __FUNCTION__ gcc variable is generally only used for debugging.