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

Side by Side Diff: base/compiler_specific.h

Issue 160673002: Use branch prediction hints to make trace events cheaper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't redefined macros. Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/debug/trace_event.h » ('j') | 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698