]> git.sesse.net Git - stockfish/commitdiff
Don't use __builtin_expect
authorMarco Costalba <mcostalba@gmail.com>
Mon, 15 Jul 2013 19:09:06 +0000 (21:09 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 15 Jul 2013 19:09:06 +0000 (21:09 +0200)
Partially revert previous patch and use
unlikey() just as code annotation.

Actually it is better to rely on a profiler for branch prediction:

http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html

"In fact, even when only one in ten thousand values is nonzero,
we're still at only roughly the break-even point"

No functional change,

src/types.h

index 8eb994551d2d6ffc7515217b05ee03a86c0e326d..155c2e899737d8223d660d65af2fd9956b505acd 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "platform.h"
 
+#define unlikely(x) (x) // For code annotation purposes
+
 #if defined(_WIN64) && !defined(IS_64BIT)
 #  include <intrin.h> // MSVC popcnt and bsfq instrinsics
 #  define IS_64BIT
 #  define FORCE_INLINE  inline
 #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
-
 #if defined(USE_POPCNT)
 const bool HasPopCnt = true;
 #else