| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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