1 | // |
2 | // Types.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: Core |
6 | // Module: Types |
7 | // |
8 | // Definitions of fixed-size integer types for various platforms |
9 | // |
10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef Foundation_Types_INCLUDED |
18 | #define Foundation_Types_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | #include <cstdint> |
23 | |
24 | |
25 | #define POCO_HAVE_INT64 1 |
26 | |
27 | |
28 | namespace Poco { |
29 | |
30 | |
31 | typedef std::int8_t Int8; |
32 | typedef std::uint8_t UInt8; |
33 | typedef std::int16_t Int16; |
34 | typedef std::uint16_t UInt16; |
35 | typedef std::int32_t Int32; |
36 | typedef std::uint32_t UInt32; |
37 | typedef std::int64_t Int64; |
38 | typedef std::uint64_t UInt64; |
39 | |
40 | |
41 | #if defined(_MSC_VER) |
42 | // |
43 | // Windows/Visual C++ |
44 | // |
45 | |
46 | #if defined(_WIN64) |
47 | #define POCO_PTR_IS_64_BIT 1 |
48 | typedef std::int64_t IntPtr; |
49 | typedef std::uint64_t UIntPtr; |
50 | #else |
51 | typedef std::int32_t IntPtr; |
52 | typedef std::uint32_t UIntPtr; |
53 | #endif |
54 | |
55 | #elif defined(__GNUC__) || defined(__clang__) |
56 | // |
57 | // Unix/GCC/Clang |
58 | // |
59 | |
60 | #if defined(_WIN64) |
61 | #define POCO_PTR_IS_64_BIT 1 |
62 | typedef std::int64_t IntPtr; |
63 | typedef std::uint64_t UIntPtr; |
64 | #else |
65 | #if defined(__LP64__) |
66 | typedef std::int64_t IntPtr; |
67 | typedef std::uint64_t UIntPtr; |
68 | #define POCO_PTR_IS_64_BIT 1 |
69 | #define POCO_LONG_IS_64_BIT 1 |
70 | #else |
71 | typedef std::int32_t IntPtr; |
72 | typedef std::uint32_t UIntPtr; |
73 | #endif |
74 | #endif |
75 | |
76 | #elif defined(__DECCXX) |
77 | // |
78 | // Compaq C++ |
79 | // |
80 | |
81 | #if defined(__VMS) |
82 | #if defined(__32BITS) |
83 | typedef std::int32_t IntPtr; |
84 | typedef std::uint32_t UIntPtr; |
85 | #else |
86 | typedef Int64 IntPtr; |
87 | typedef UInt64 UIntPtr; |
88 | #define POCO_PTR_IS_64_BIT 1 |
89 | #endif |
90 | #else |
91 | typedef Int64 IntPtr; |
92 | typedef UInt64 UIntPtr; |
93 | #define POCO_PTR_IS_64_BIT 1 |
94 | #define POCO_LONG_IS_64_BIT 1 |
95 | #endif |
96 | |
97 | #elif defined(__HP_aCC) |
98 | // |
99 | // HP Ansi C++ |
100 | // |
101 | |
102 | #if defined(__LP64__) |
103 | #define POCO_PTR_IS_64_BIT 1 |
104 | #define POCO_LONG_IS_64_BIT 1 |
105 | typedef Int64 IntPtr; |
106 | typedef UInt64 UIntPtr; |
107 | #else |
108 | typedef Int32 IntPtr; |
109 | typedef UInt32 UIntPtr; |
110 | #endif |
111 | |
112 | #elif defined(__SUNPRO_CC) |
113 | // |
114 | // SUN Forte C++ |
115 | // |
116 | |
117 | #if defined(__sparcv9) |
118 | #define POCO_PTR_IS_64_BIT 1 |
119 | #define POCO_LONG_IS_64_BIT 1 |
120 | typedef Int64 IntPtr; |
121 | typedef UInt64 UIntPtr; |
122 | #else |
123 | typedef Int32 IntPtr; |
124 | typedef UInt32 UIntPtr; |
125 | #endif |
126 | |
127 | #elif defined(__IBMCPP__) |
128 | // |
129 | // IBM XL C++ |
130 | // |
131 | |
132 | #if defined(__64BIT__) |
133 | #define POCO_PTR_IS_64_BIT 1 |
134 | #define POCO_LONG_IS_64_BIT 1 |
135 | typedef Int64 IntPtr; |
136 | typedef UInt64 UIntPtr; |
137 | #else |
138 | typedef Int32 IntPtr; |
139 | typedef UInt32 UIntPtr; |
140 | #endif |
141 | |
142 | #elif defined(__sgi) |
143 | // |
144 | // MIPSpro C++ |
145 | // |
146 | |
147 | #if _MIPS_SZLONG == 64 |
148 | #define POCO_PTR_IS_64_BIT 1 |
149 | #define POCO_LONG_IS_64_BIT 1 |
150 | typedef Int64 IntPtr; |
151 | typedef UInt64 UIntPtr; |
152 | #else |
153 | typedef Int32 IntPtr; |
154 | typedef UInt32 UIntPtr; |
155 | #endif |
156 | |
157 | #endif |
158 | |
159 | |
160 | #if defined(POCO_PTR_IS_64_BIT) && (POCO_PTR_IS_64_BIT == 1) |
161 | #define POCO_64_BIT |
162 | #endif |
163 | |
164 | |
165 | } // namespace Poco |
166 | |
167 | |
168 | #endif // Foundation_Types_INCLUDED |
169 | |