Index: base/compiler_specific.h |
diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
index 2ba34da1cc4bbfef27264de7b34ece19628ef1b0..cbb60a0d6783e4d7f72f5aae449b3460eb6a3005 100644 |
--- a/base/compiler_specific.h |
+++ b/base/compiler_specific.h |
@@ -218,4 +218,22 @@ |
#endif // defined(OS_WIN) |
#endif // !defined(CDECL) |
+// Macro for hinting that an expression is likely to be true. |
+#if !defined(LIKELY) |
+#if defined(COMPILER_GCC) |
+#define LIKELY(x) __builtin_expect(!!(x), 1) |
+#else |
+#define LIKELY(x) (x) |
+#endif // defined(COMPILER_GCC) |
+#endif // !defined(LIKELY) |
+ |
+// Macro for hinting that an expression is likely to be false. |
+#if !defined(UNLIKELY) |
+#if defined(COMPILER_GCC) |
+#define UNLIKELY(x) __builtin_expect(!!(x), 0) |
+#else |
+#define UNLIKELY(x) (x) |
+#endif // defined(COMPILER_GCC) |
+#endif // !defined(UNLIKELY) |
+ |
#endif // BASE_COMPILER_SPECIFIC_H_ |