summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-03-25 11:37:24 +0000
committerJosé Fonseca <[email protected]>2011-03-25 16:22:28 +0000
commit5858abec6efd01d6d190d9116ff803c096bc279b (patch)
treedd1f2154da139b719b10dffe54cd3570c8116a23
parentacd7ce57f79b3bd729041dc97c04a78386d13404 (diff)
gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers.
-rw-r--r--src/gallium/include/pipe/p_compiler.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 3441db685ce..8c788f4bb0e 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -292,12 +292,14 @@ void _ReadWriteBarrier(void);
* Note that profile guided optimization can offer better results, but
* needs an appropriate coverage suite and does not inform human readers.
*/
-#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)
+#ifndef likely
+# if defined(__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
#endif