Chromium Code Reviews| Index: base/compiler_specific.h |
| diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
| index 0dbc3ae576688908b41a1b5921c744a71f5ada4c..bb4c52be45e298b31c73566f8b927445a7a952f4 100644 |
| --- a/base/compiler_specific.h |
| +++ b/base/compiler_specific.h |
| @@ -100,6 +100,14 @@ |
| #define NOINLINE |
| #endif |
| +#if COMPILER_GCC && defined(NDEBUG) |
| +#define ALWAYS_INLINE inline __attribute__((__always_inline__)) |
| +#elif COMPILER_MSVC && defined(NDEBUG) |
| +#define ALWAYS_INLINE __forceinline |
| +#else |
| +#define ALWAYS_INLINE inline |
| +#endif |
| + |
| // Specify memory alignment for structs, classes, etc. |
| // Use like: |
| // class ALIGNAS(16) MyClass { ... } |
| @@ -196,6 +204,14 @@ |
| #endif // defined(COMPILER_GCC) |
| #endif // !defined(UNLIKELY) |
| +#if !defined(LIKELY) |
| +#if defined(COMPILER_GCC) |
| +#define LIKELY(x) __builtin_expect((x), 1) |
|
sdefresne
2016/11/08 08:40:20
Shouldn't this be __builtin_expect(!!(x), 1)? Othe
palmer
2016/11/16 23:45:21
Somehow, I missed this comment. Fix coming right u
|
| +#else |
| +#define LIKELY(x) (x) |
| +#endif // defined(COMPILER_GCC) |
| +#endif // !defined(LIKELY) |
| + |
| // Compiler feature-detection. |
| // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension |
| #if defined(__has_feature) |