OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef BASE_COMPILER_SPECIFIC_H_ |
6 #define BASE_COMPILER_SPECIFIC_H_ | 6 #define BASE_COMPILER_SPECIFIC_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(COMPILER_MSVC) | 10 #if defined(COMPILER_MSVC) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 // Macro useful for writing cross-platform function pointers. | 212 // Macro useful for writing cross-platform function pointers. |
213 #if !defined(CDECL) | 213 #if !defined(CDECL) |
214 #if defined(OS_WIN) | 214 #if defined(OS_WIN) |
215 #define CDECL __cdecl | 215 #define CDECL __cdecl |
216 #else // defined(OS_WIN) | 216 #else // defined(OS_WIN) |
217 #define CDECL | 217 #define CDECL |
218 #endif // defined(OS_WIN) | 218 #endif // defined(OS_WIN) |
219 #endif // !defined(CDECL) | 219 #endif // !defined(CDECL) |
220 | 220 |
| 221 // Macro for hinting that an expression is likely to be true. |
| 222 #if !defined(LIKELY) |
| 223 #if defined(COMPILER_GCC) |
| 224 #define LIKELY(x) __builtin_expect(!!(x), 1) |
| 225 #else |
| 226 #define LIKELY(x) (x) |
| 227 #endif // defined(COMPILER_GCC) |
| 228 #endif // !defined(LIKELY) |
| 229 |
| 230 // Macro for hinting that an expression is likely to be false. |
| 231 #if !defined(UNLIKELY) |
| 232 #if defined(COMPILER_GCC) |
| 233 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
| 234 #else |
| 235 #define UNLIKELY(x) (x) |
| 236 #endif // defined(COMPILER_GCC) |
| 237 #endif // !defined(UNLIKELY) |
| 238 |
221 #endif // BASE_COMPILER_SPECIFIC_H_ | 239 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |