gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 25 Mar 2011 11:37:24 +0000 (11:37 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 25 Mar 2011 16:22:28 +0000 (16:22 +0000)
src/gallium/include/pipe/p_compiler.h

index 3441db685ce44c3f5fbb9957db40c5b571d25d1b..8c788f4bb0e375dec3a8d2ff9aa59dadcbed2362 100644 (file)
@@ -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