ATLAS Offline Software
AthUnlikelyMacros.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CXXUTILS_ATHUNLIKELYMACROS_H
6 #define CXXUTILS_ATHUNLIKELYMACROS_H 1
7 
8 /* macros modeled after http://kernelnewbies.org/FAQ/LikelyUnlikely
9  * to help the compiler into generating instructions to optimize the
10  * branch prediction.
11  */
12 #if __GNUC__ >= 4
13 # define ATH_LIKELY(x) __builtin_expect(!!(x), 1)
14 # define ATH_UNLIKELY(x) __builtin_expect(!!(x), 0)
15 #else
16 # define ATH_LIKELY(x) (x)
17 # define ATH_UNLIKELY(x) (x)
18 #endif
19 
20 #endif /* !CXXUTILS_ATHUNLIKELYMACROS_H */