The Gaudi Framework  v30r3 (a5ef0a68)
Kernel.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_KERNEL_H
2 #define GAUDIKERNEL_KERNEL_H
3 
4 // Some pragmas to avoid warnings in VisualC
5 #ifdef _WIN32
6 // Disable warning C4786: identifier was truncated to '255' characters in the debug information
7 #pragma warning( disable : 4786 )
8 // Disable warning C4291: no matching operator delete found; memory will not be freed if initialization throws an
9 // exception
10 #pragma warning( disable : 4291 )
11 // Disable warning C4250: inheritance via dominance
12 #pragma warning( disable : 4250 )
13 #endif
14 
15 // Large integer definition depends of the platform
16 #ifdef _WIN32
17 #ifndef NO_LONGLONG_TYPEDEF
18 typedef __int64 longlong;
19 typedef unsigned __int64 ulonglong;
20 #endif
21 
22 #ifndef LONGLONG_MAX
23 #define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL
24 #endif
25 #ifndef LONGLONG_MIN
26 #define LONGLONG_MIN 0x8000000000000000LL
27 #endif
28 
29 #ifndef ULONGLONG_MAX
30 #define ULONGLONG_MAX 0xFFFFFFFFFFFFFFFFLL
31 #endif
32 #ifndef ULONGLONG_MIN
33 #define ULONGLONG_MIN 0x0000000000000000LL
34 #endif
35 #elif defined( __linux ) || defined( __APPLE__ )
36 #ifndef NO_LONGLONG_TYPEDEF
37 typedef long long int longlong;
38 typedef unsigned long long int ulonglong;
39 #endif
40 
41 #ifndef LONGLONG_MAX
42 #define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL
43 #endif
44 #ifndef LONGLONG_MIN
45 #define LONGLONG_MIN 0x8000000000000000LL
46 #endif
47 
48 #ifndef ULONGLONG_MAX
49 #define ULONGLONG_MAX 0xfFFFFFFFFFFFFFFFLL
50 #endif
51 #ifndef ULONGLONG_MIN
52 #define ULONGLONG_MIN 0x0000000000000000LL
53 #endif
54 #else
55 // This will not really work !!
56 struct __longlong {
57 public:
58  long __data[2];
59 };
62 static const __longlong LONGLONG_MAX = {0x7FFFFFFF, 0xFFFFFFFF};
63 static const __longlong LONGLONG_MIN = {0x80000000, 0x00000000};
64 static const __ulonglong ULONGLONG_MAX = {0xFFFFFFFF, 0xFFFFFFFF};
65 static const __ulonglong ULONGLONG_MIN = {0x00000000, 0x00000000};
66 #endif // linux
67 
68 // ---------------------------------- Symbol visibility macros (begin)
69 // Enabled on in Gaudi v21 mode
70 #if !defined( GAUDI_V20_COMPAT ) || defined( G21_HIDE_SYMBOLS )
71 // These macros will allow selection on exported symbols
72 // taken from http://gcc.gnu.org/wiki/Visibility
73 #if __GNUC__ >= 4 && !defined( __CINT__ )
74 #define GAUDI_HASCLASSVISIBILITY
75 #endif
76 
77 #ifdef _WIN32
78 /*
79 # define GAUDI_IMPORT __declspec(dllimport)
80 # define GAUDI_EXPORT __declspec(dllexport)
81 # define GAUDI_LOCAL
82 */
83 // The symbol visibility is disabled on Win32 because it is not possible to
84 // make coexists the gcc and VC ways.
85 #define GAUDI_IMPORT
86 #define GAUDI_EXPORT
87 #define GAUDI_LOCAL
88 #else
89 #if defined( GAUDI_HASCLASSVISIBILITY )
90 #define GAUDI_IMPORT __attribute__( ( visibility( "default" ) ) )
91 #define GAUDI_EXPORT __attribute__( ( visibility( "default" ) ) )
92 #define GAUDI_LOCAL __attribute__( ( visibility( "hidden" ) ) )
93 #else
94 #define GAUDI_IMPORT
95 #define GAUDI_EXPORT
96 #define GAUDI_LOCAL
97 #endif
98 #endif
99 
100 // Define GAUDI_API for DLL builds
101 #ifdef GAUDI_LINKER_LIBRARY
102 #define GAUDI_API GAUDI_EXPORT
103 #else
104 #define GAUDI_API GAUDI_IMPORT
105 #endif
106 #else
107 // Dummy definitions for the backward compatibility mode.
108 #define GAUDI_API
109 #define GAUDI_IMPORT
110 #define GAUDI_EXPORT
111 #define GAUDI_LOCAL
112 #endif // GAUDI_V20_COMPAT
113 // ---------------------------------- Symbol visibility macros (end)
114 
115 // -------------- LIKELY/UNLIKELY macros (begin)
116 // Use compiler hinting to improve branch prediction for linux
117 #ifdef __GNUC__
118 #define LIKELY( x ) __builtin_expect( ( x ), 1 )
119 #define UNLIKELY( x ) __builtin_expect( ( x ), 0 )
120 #else
121 #define LIKELY( x ) x
122 #define UNLIKELY( x ) x
123 #endif
124 // -------------- LIKELY/UNLIKELY macros (end)
125 
126 #endif // GAUDIKERNEL_KERNEL_H
__longlong ulonglong
Definition: Kernel.h:61
long __data[2]
Definition: Kernel.h:58
__longlong longlong
Definition: Kernel.h:60