The Gaudi Framework  v29r0 (ff2e7097)
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 #ifdef _WIN32
69 #define TEMPLATE_SPECIALIZATION template <>
70 #elif defined( __linux ) || defined( __APPLE__ )
71 #define TEMPLATE_SPECIALIZATION
72 #endif
73 
74 // ---------------------------------- Symbol visibility macros (begin)
75 // Enabled on in Gaudi v21 mode
76 #if !defined( GAUDI_V20_COMPAT ) || defined( G21_HIDE_SYMBOLS )
77 // These macros will allow selection on exported symbols
78 // taken from http://gcc.gnu.org/wiki/Visibility
79 #if __GNUC__ >= 4 && !defined( __CINT__ )
80 #define GAUDI_HASCLASSVISIBILITY
81 #endif
82 
83 #ifdef _WIN32
84 /*
85 # define GAUDI_IMPORT __declspec(dllimport)
86 # define GAUDI_EXPORT __declspec(dllexport)
87 # define GAUDI_LOCAL
88 */
89 // The symbol visibility is disabled on Win32 because it is not possible to
90 // make coexists the gcc and VC ways.
91 #define GAUDI_IMPORT
92 #define GAUDI_EXPORT
93 #define GAUDI_LOCAL
94 #else
95 #if defined( GAUDI_HASCLASSVISIBILITY )
96 #define GAUDI_IMPORT __attribute__( ( visibility( "default" ) ) )
97 #define GAUDI_EXPORT __attribute__( ( visibility( "default" ) ) )
98 #define GAUDI_LOCAL __attribute__( ( visibility( "hidden" ) ) )
99 #else
100 #define GAUDI_IMPORT
101 #define GAUDI_EXPORT
102 #define GAUDI_LOCAL
103 #endif
104 #endif
105 
106 // Define GAUDI_API for DLL builds
107 #ifdef GAUDI_LINKER_LIBRARY
108 #define GAUDI_API GAUDI_EXPORT
109 #else
110 #define GAUDI_API GAUDI_IMPORT
111 #endif
112 #else
113 // Dummy definitions for the backward compatibility mode.
114 #define GAUDI_API
115 #define GAUDI_IMPORT
116 #define GAUDI_EXPORT
117 #define GAUDI_LOCAL
118 #endif // GAUDI_V20_COMPAT
119 // ---------------------------------- Symbol visibility macros (end)
120 
121 // -------------- LIKELY/UNLIKELY macros (begin)
122 // Use compiler hinting to improve branch prediction for linux
123 #ifdef __GNUC__
124 #define LIKELY( x ) __builtin_expect( ( x ), 1 )
125 #define UNLIKELY( x ) __builtin_expect( ( x ), 0 )
126 #else
127 #define LIKELY( x ) x
128 #define UNLIKELY( x ) x
129 #endif
130 // -------------- LIKELY/UNLIKELY macros (end)
131 
132 #endif // GAUDIKERNEL_KERNEL_H
__longlong ulonglong
Definition: Kernel.h:61
long __data[2]
Definition: Kernel.h:58
__longlong longlong
Definition: Kernel.h:60