Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/defs/compiler.h @ 5040

Last change on this file since 5040 was 3860, checked in by bensch, 20 years ago

orxonox/trunk: moved likely to compiler.h in defs
also reset all the UNLIKELY_IF functions to how they should look.

the old approach is still valid, but depricated.

@patrick: i hope this is ok for you, for it is LINUX-standard.
and i think windows is also able to handle likely/unlikely because it is a compiler issue not a system issue

File size: 545 bytes
Line 
1
2#ifndef _COMPILER_H
3#define _COMPILER_H
4
5/* performance tweaking stuff */
6#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
7#define __builtin_expect(x, expected_value) (x)
8#endif
9
10#define likely(x)       __builtin_expect((x),1)
11#define unlikely(x)     __builtin_expect((x),0)
12
13#ifdef __unix__
14
15// deprecated //
16 #define __LIKELY_IF(condition)  if( likely(condition))
17 #define __UNLIKELY_IF(condition) if( unlikely(condition))
18#else
19 #define __LIKELY_IF(condition)  if( condition)
20 #define __UNLIKELY_IF(condition) if( condition)
21#endif
22
23
24#endif /* _COMPILER_H */
Note: See TracBrowser for help on using the repository browser.