Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: base/compiler_specific.h

Issue 2507293002: Correct the check in LIKELY. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if !defined(UNLIKELY) 199 #if !defined(UNLIKELY)
200 #if defined(COMPILER_GCC) 200 #if defined(COMPILER_GCC)
201 #define UNLIKELY(x) __builtin_expect(!!(x), 0) 201 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
202 #else 202 #else
203 #define UNLIKELY(x) (x) 203 #define UNLIKELY(x) (x)
204 #endif // defined(COMPILER_GCC) 204 #endif // defined(COMPILER_GCC)
205 #endif // !defined(UNLIKELY) 205 #endif // !defined(UNLIKELY)
206 206
207 #if !defined(LIKELY) 207 #if !defined(LIKELY)
208 #if defined(COMPILER_GCC) 208 #if defined(COMPILER_GCC)
209 #define LIKELY(x) __builtin_expect((x), 1) 209 #define LIKELY(x) __builtin_expect(!!(x), 1)
210 #else 210 #else
211 #define LIKELY(x) (x) 211 #define LIKELY(x) (x)
212 #endif // defined(COMPILER_GCC) 212 #endif // defined(COMPILER_GCC)
213 #endif // !defined(LIKELY) 213 #endif // !defined(LIKELY)
214 214
215 // Compiler feature-detection. 215 // Compiler feature-detection.
216 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension 216 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
217 #if defined(__has_feature) 217 #if defined(__has_feature)
218 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) 218 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE)
219 #else 219 #else
220 #define HAS_FEATURE(FEATURE) 0 220 #define HAS_FEATURE(FEATURE) 0
221 #endif 221 #endif
222 222
223 #endif // BASE_COMPILER_SPECIFIC_H_ 223 #endif // BASE_COMPILER_SPECIFIC_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698