ROFL-pipeline  v0.6.0dev
likely.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef LIKELY_H
6 #define LIKELY_H 1
7 
8 #ifdef LIKELY_CUSTOM_HDR
9 
10 #include "likely_custom.h"
11 
12 #else
13 
14  //#if defined(__GCC__) || defined(__INTEL_COMPILER)
15  #if defined(__GNUC__) || defined(__INTEL_COMPILER)
16 
17  #ifndef likely
18  #define likely(x) __builtin_expect(((x)),1)
19  #endif
20 
21  #ifndef unlikely
22  #define unlikely(x) __builtin_expect(((x)),0)
23  #endif
24 
25  #else
26 
27  #ifndef likely
28  #define likely(x) x
29  #endif
30 
31  #ifndef unlikely
32  #define unlikely(x) x
33  #endif
34 
35  #endif //ifdef GCC or ICC
36 
37 #endif //LIKELY_CUSTOM_HDR
38 
39 #endif /* LIKELY_H_ */