Chris@16
|
1 // boost cstdint.hpp header file ------------------------------------------//
|
Chris@16
|
2
|
Chris@16
|
3 // (C) Copyright Beman Dawes 1999.
|
Chris@16
|
4 // (C) Copyright Jens Mauer 2001
|
Chris@16
|
5 // (C) Copyright John Maddock 2001
|
Chris@16
|
6 // Distributed under the Boost
|
Chris@16
|
7 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
8 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9
|
Chris@16
|
10 // See http://www.boost.org/libs/integer for documentation.
|
Chris@16
|
11
|
Chris@16
|
12 // Revision History
|
Chris@16
|
13 // 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.)
|
Chris@16
|
14 // 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer)
|
Chris@16
|
15 // 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer)
|
Chris@16
|
16 // 12 Nov 00 Merged <boost/stdint.h> (Jens Maurer)
|
Chris@16
|
17 // 23 Sep 00 Added INTXX_C macro support (John Maddock).
|
Chris@16
|
18 // 22 Sep 00 Better 64-bit support (John Maddock)
|
Chris@16
|
19 // 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost
|
Chris@16
|
20 // 8 Aug 99 Initial version (Beman Dawes)
|
Chris@16
|
21
|
Chris@16
|
22
|
Chris@16
|
23 #ifndef BOOST_CSTDINT_HPP
|
Chris@16
|
24 #define BOOST_CSTDINT_HPP
|
Chris@16
|
25
|
Chris@16
|
26 //
|
Chris@16
|
27 // Since we always define the INT#_C macros as per C++0x,
|
Chris@16
|
28 // define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
|
Chris@16
|
29 // thing if possible, and so that the user knows that the macros
|
Chris@16
|
30 // are actually defined as per C99.
|
Chris@16
|
31 //
|
Chris@16
|
32 #ifndef __STDC_CONSTANT_MACROS
|
Chris@16
|
33 # define __STDC_CONSTANT_MACROS
|
Chris@16
|
34 #endif
|
Chris@16
|
35
|
Chris@16
|
36 #include <boost/config.hpp>
|
Chris@16
|
37
|
Chris@16
|
38 //
|
Chris@16
|
39 // Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
|
Chris@16
|
40 // depending upon what headers happen to have been included first...
|
Chris@16
|
41 // so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
|
Chris@16
|
42 // See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
|
Chris@16
|
43 //
|
Chris@16
|
44 #if defined(BOOST_HAS_STDINT_H) \
|
Chris@16
|
45 && (!defined(__GLIBC__) \
|
Chris@16
|
46 || defined(__GLIBC_HAVE_LONG_LONG) \
|
Chris@16
|
47 || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))
|
Chris@16
|
48
|
Chris@16
|
49 // The following #include is an implementation artifact; not part of interface.
|
Chris@16
|
50 # ifdef __hpux
|
Chris@16
|
51 // HP-UX has a vaguely nice <stdint.h> in a non-standard location
|
Chris@16
|
52 # include <inttypes.h>
|
Chris@16
|
53 # ifdef __STDC_32_MODE__
|
Chris@16
|
54 // this is triggered with GCC, because it defines __cplusplus < 199707L
|
Chris@16
|
55 # define BOOST_NO_INT64_T
|
Chris@16
|
56 # endif
|
Chris@16
|
57 # elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
|
Chris@16
|
58 # include <inttypes.h>
|
Chris@16
|
59 # else
|
Chris@16
|
60 # include <stdint.h>
|
Chris@16
|
61
|
Chris@16
|
62 // There is a bug in Cygwin two _C macros
|
Chris@16
|
63 # if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__)
|
Chris@16
|
64 # undef INTMAX_C
|
Chris@16
|
65 # undef UINTMAX_C
|
Chris@16
|
66 # define INTMAX_C(c) c##LL
|
Chris@16
|
67 # define UINTMAX_C(c) c##ULL
|
Chris@16
|
68 # endif
|
Chris@16
|
69
|
Chris@16
|
70 # endif
|
Chris@16
|
71
|
Chris@16
|
72 #ifdef __QNX__
|
Chris@16
|
73
|
Chris@16
|
74 // QNX (Dinkumware stdlib) defines these as non-standard names.
|
Chris@16
|
75 // Reflect to the standard names.
|
Chris@16
|
76
|
Chris@16
|
77 typedef ::intleast8_t int_least8_t;
|
Chris@16
|
78 typedef ::intfast8_t int_fast8_t;
|
Chris@16
|
79 typedef ::uintleast8_t uint_least8_t;
|
Chris@16
|
80 typedef ::uintfast8_t uint_fast8_t;
|
Chris@16
|
81
|
Chris@16
|
82 typedef ::intleast16_t int_least16_t;
|
Chris@16
|
83 typedef ::intfast16_t int_fast16_t;
|
Chris@16
|
84 typedef ::uintleast16_t uint_least16_t;
|
Chris@16
|
85 typedef ::uintfast16_t uint_fast16_t;
|
Chris@16
|
86
|
Chris@16
|
87 typedef ::intleast32_t int_least32_t;
|
Chris@16
|
88 typedef ::intfast32_t int_fast32_t;
|
Chris@16
|
89 typedef ::uintleast32_t uint_least32_t;
|
Chris@16
|
90 typedef ::uintfast32_t uint_fast32_t;
|
Chris@16
|
91
|
Chris@16
|
92 # ifndef BOOST_NO_INT64_T
|
Chris@16
|
93
|
Chris@16
|
94 typedef ::intleast64_t int_least64_t;
|
Chris@16
|
95 typedef ::intfast64_t int_fast64_t;
|
Chris@16
|
96 typedef ::uintleast64_t uint_least64_t;
|
Chris@16
|
97 typedef ::uintfast64_t uint_fast64_t;
|
Chris@16
|
98
|
Chris@16
|
99 # endif
|
Chris@16
|
100
|
Chris@16
|
101 #endif
|
Chris@16
|
102
|
Chris@16
|
103 namespace boost
|
Chris@16
|
104 {
|
Chris@16
|
105
|
Chris@16
|
106 using ::int8_t;
|
Chris@16
|
107 using ::int_least8_t;
|
Chris@16
|
108 using ::int_fast8_t;
|
Chris@16
|
109 using ::uint8_t;
|
Chris@16
|
110 using ::uint_least8_t;
|
Chris@16
|
111 using ::uint_fast8_t;
|
Chris@16
|
112
|
Chris@16
|
113 using ::int16_t;
|
Chris@16
|
114 using ::int_least16_t;
|
Chris@16
|
115 using ::int_fast16_t;
|
Chris@16
|
116 using ::uint16_t;
|
Chris@16
|
117 using ::uint_least16_t;
|
Chris@16
|
118 using ::uint_fast16_t;
|
Chris@16
|
119
|
Chris@16
|
120 using ::int32_t;
|
Chris@16
|
121 using ::int_least32_t;
|
Chris@16
|
122 using ::int_fast32_t;
|
Chris@16
|
123 using ::uint32_t;
|
Chris@16
|
124 using ::uint_least32_t;
|
Chris@16
|
125 using ::uint_fast32_t;
|
Chris@16
|
126
|
Chris@16
|
127 # ifndef BOOST_NO_INT64_T
|
Chris@16
|
128
|
Chris@16
|
129 using ::int64_t;
|
Chris@16
|
130 using ::int_least64_t;
|
Chris@16
|
131 using ::int_fast64_t;
|
Chris@16
|
132 using ::uint64_t;
|
Chris@16
|
133 using ::uint_least64_t;
|
Chris@16
|
134 using ::uint_fast64_t;
|
Chris@16
|
135
|
Chris@16
|
136 # endif
|
Chris@16
|
137
|
Chris@16
|
138 using ::intmax_t;
|
Chris@16
|
139 using ::uintmax_t;
|
Chris@16
|
140
|
Chris@16
|
141 } // namespace boost
|
Chris@16
|
142
|
Chris@101
|
143 #elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) || defined(__VMS) || defined(__SOLARIS9__) || defined(__NetBSD__)
|
Chris@16
|
144 // FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need.
|
Chris@16
|
145 # include <inttypes.h>
|
Chris@16
|
146
|
Chris@16
|
147 namespace boost {
|
Chris@16
|
148
|
Chris@16
|
149 using ::int8_t;
|
Chris@16
|
150 typedef int8_t int_least8_t;
|
Chris@16
|
151 typedef int8_t int_fast8_t;
|
Chris@16
|
152 using ::uint8_t;
|
Chris@16
|
153 typedef uint8_t uint_least8_t;
|
Chris@16
|
154 typedef uint8_t uint_fast8_t;
|
Chris@16
|
155
|
Chris@16
|
156 using ::int16_t;
|
Chris@16
|
157 typedef int16_t int_least16_t;
|
Chris@16
|
158 typedef int16_t int_fast16_t;
|
Chris@16
|
159 using ::uint16_t;
|
Chris@16
|
160 typedef uint16_t uint_least16_t;
|
Chris@16
|
161 typedef uint16_t uint_fast16_t;
|
Chris@16
|
162
|
Chris@16
|
163 using ::int32_t;
|
Chris@16
|
164 typedef int32_t int_least32_t;
|
Chris@16
|
165 typedef int32_t int_fast32_t;
|
Chris@16
|
166 using ::uint32_t;
|
Chris@16
|
167 typedef uint32_t uint_least32_t;
|
Chris@16
|
168 typedef uint32_t uint_fast32_t;
|
Chris@16
|
169
|
Chris@16
|
170 # ifndef BOOST_NO_INT64_T
|
Chris@16
|
171
|
Chris@16
|
172 using ::int64_t;
|
Chris@16
|
173 typedef int64_t int_least64_t;
|
Chris@16
|
174 typedef int64_t int_fast64_t;
|
Chris@16
|
175 using ::uint64_t;
|
Chris@16
|
176 typedef uint64_t uint_least64_t;
|
Chris@16
|
177 typedef uint64_t uint_fast64_t;
|
Chris@16
|
178
|
Chris@16
|
179 typedef int64_t intmax_t;
|
Chris@16
|
180 typedef uint64_t uintmax_t;
|
Chris@16
|
181
|
Chris@16
|
182 # else
|
Chris@16
|
183
|
Chris@16
|
184 typedef int32_t intmax_t;
|
Chris@16
|
185 typedef uint32_t uintmax_t;
|
Chris@16
|
186
|
Chris@16
|
187 # endif
|
Chris@16
|
188
|
Chris@16
|
189 } // namespace boost
|
Chris@16
|
190
|
Chris@16
|
191 #else // BOOST_HAS_STDINT_H
|
Chris@16
|
192
|
Chris@16
|
193 # include <boost/limits.hpp> // implementation artifact; not part of interface
|
Chris@16
|
194 # include <limits.h> // needed for limits macros
|
Chris@16
|
195
|
Chris@16
|
196
|
Chris@16
|
197 namespace boost
|
Chris@16
|
198 {
|
Chris@16
|
199
|
Chris@16
|
200 // These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit
|
Chris@16
|
201 // platforms. For other systems, they will have to be hand tailored.
|
Chris@16
|
202 //
|
Chris@16
|
203 // Because the fast types are assumed to be the same as the undecorated types,
|
Chris@16
|
204 // it may be possible to hand tailor a more efficient implementation. Such
|
Chris@16
|
205 // an optimization may be illusionary; on the Intel x86-family 386 on, for
|
Chris@16
|
206 // example, byte arithmetic and load/stores are as fast as "int" sized ones.
|
Chris@16
|
207
|
Chris@16
|
208 // 8-bit types ------------------------------------------------------------//
|
Chris@16
|
209
|
Chris@16
|
210 # if UCHAR_MAX == 0xff
|
Chris@16
|
211 typedef signed char int8_t;
|
Chris@16
|
212 typedef signed char int_least8_t;
|
Chris@16
|
213 typedef signed char int_fast8_t;
|
Chris@16
|
214 typedef unsigned char uint8_t;
|
Chris@16
|
215 typedef unsigned char uint_least8_t;
|
Chris@16
|
216 typedef unsigned char uint_fast8_t;
|
Chris@16
|
217 # else
|
Chris@16
|
218 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
219 # endif
|
Chris@16
|
220
|
Chris@16
|
221 // 16-bit types -----------------------------------------------------------//
|
Chris@16
|
222
|
Chris@16
|
223 # if USHRT_MAX == 0xffff
|
Chris@16
|
224 # if defined(__crayx1)
|
Chris@16
|
225 // The Cray X1 has a 16-bit short, however it is not recommend
|
Chris@16
|
226 // for use in performance critical code.
|
Chris@16
|
227 typedef short int16_t;
|
Chris@16
|
228 typedef short int_least16_t;
|
Chris@16
|
229 typedef int int_fast16_t;
|
Chris@16
|
230 typedef unsigned short uint16_t;
|
Chris@16
|
231 typedef unsigned short uint_least16_t;
|
Chris@16
|
232 typedef unsigned int uint_fast16_t;
|
Chris@16
|
233 # else
|
Chris@16
|
234 typedef short int16_t;
|
Chris@16
|
235 typedef short int_least16_t;
|
Chris@16
|
236 typedef short int_fast16_t;
|
Chris@16
|
237 typedef unsigned short uint16_t;
|
Chris@16
|
238 typedef unsigned short uint_least16_t;
|
Chris@16
|
239 typedef unsigned short uint_fast16_t;
|
Chris@16
|
240 # endif
|
Chris@16
|
241 # elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
|
Chris@16
|
242 // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
|
Chris@16
|
243 // MTA / XMT does support the following non-standard integer types
|
Chris@16
|
244 typedef __short16 int16_t;
|
Chris@16
|
245 typedef __short16 int_least16_t;
|
Chris@16
|
246 typedef __short16 int_fast16_t;
|
Chris@16
|
247 typedef unsigned __short16 uint16_t;
|
Chris@16
|
248 typedef unsigned __short16 uint_least16_t;
|
Chris@16
|
249 typedef unsigned __short16 uint_fast16_t;
|
Chris@16
|
250 # elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
|
Chris@16
|
251 // no 16-bit types on Cray:
|
Chris@16
|
252 typedef short int_least16_t;
|
Chris@16
|
253 typedef short int_fast16_t;
|
Chris@16
|
254 typedef unsigned short uint_least16_t;
|
Chris@16
|
255 typedef unsigned short uint_fast16_t;
|
Chris@16
|
256 # else
|
Chris@16
|
257 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
258 # endif
|
Chris@16
|
259
|
Chris@16
|
260 // 32-bit types -----------------------------------------------------------//
|
Chris@16
|
261
|
Chris@16
|
262 # if UINT_MAX == 0xffffffff
|
Chris@16
|
263 typedef int int32_t;
|
Chris@16
|
264 typedef int int_least32_t;
|
Chris@16
|
265 typedef int int_fast32_t;
|
Chris@16
|
266 typedef unsigned int uint32_t;
|
Chris@16
|
267 typedef unsigned int uint_least32_t;
|
Chris@16
|
268 typedef unsigned int uint_fast32_t;
|
Chris@16
|
269 # elif (USHRT_MAX == 0xffffffff)
|
Chris@16
|
270 typedef short int32_t;
|
Chris@16
|
271 typedef short int_least32_t;
|
Chris@16
|
272 typedef short int_fast32_t;
|
Chris@16
|
273 typedef unsigned short uint32_t;
|
Chris@16
|
274 typedef unsigned short uint_least32_t;
|
Chris@16
|
275 typedef unsigned short uint_fast32_t;
|
Chris@16
|
276 # elif ULONG_MAX == 0xffffffff
|
Chris@16
|
277 typedef long int32_t;
|
Chris@16
|
278 typedef long int_least32_t;
|
Chris@16
|
279 typedef long int_fast32_t;
|
Chris@16
|
280 typedef unsigned long uint32_t;
|
Chris@16
|
281 typedef unsigned long uint_least32_t;
|
Chris@16
|
282 typedef unsigned long uint_fast32_t;
|
Chris@16
|
283 # elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
|
Chris@16
|
284 // Integers are 64 bits on the MTA / XMT
|
Chris@16
|
285 typedef __int32 int32_t;
|
Chris@16
|
286 typedef __int32 int_least32_t;
|
Chris@16
|
287 typedef __int32 int_fast32_t;
|
Chris@16
|
288 typedef unsigned __int32 uint32_t;
|
Chris@16
|
289 typedef unsigned __int32 uint_least32_t;
|
Chris@16
|
290 typedef unsigned __int32 uint_fast32_t;
|
Chris@16
|
291 # else
|
Chris@16
|
292 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
293 # endif
|
Chris@16
|
294
|
Chris@16
|
295 // 64-bit types + intmax_t and uintmax_t ----------------------------------//
|
Chris@16
|
296
|
Chris@16
|
297 # if defined(BOOST_HAS_LONG_LONG) && \
|
Chris@16
|
298 !defined(BOOST_MSVC) && !defined(__BORLANDC__) && \
|
Chris@16
|
299 (!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \
|
Chris@16
|
300 (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
|
Chris@16
|
301 # if defined(__hpux)
|
Chris@16
|
302 // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
|
Chris@16
|
303 # elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL)
|
Chris@16
|
304 // 2**64 - 1
|
Chris@16
|
305 # else
|
Chris@16
|
306 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
307 # endif
|
Chris@16
|
308
|
Chris@16
|
309 typedef ::boost::long_long_type intmax_t;
|
Chris@16
|
310 typedef ::boost::ulong_long_type uintmax_t;
|
Chris@16
|
311 typedef ::boost::long_long_type int64_t;
|
Chris@16
|
312 typedef ::boost::long_long_type int_least64_t;
|
Chris@16
|
313 typedef ::boost::long_long_type int_fast64_t;
|
Chris@16
|
314 typedef ::boost::ulong_long_type uint64_t;
|
Chris@16
|
315 typedef ::boost::ulong_long_type uint_least64_t;
|
Chris@16
|
316 typedef ::boost::ulong_long_type uint_fast64_t;
|
Chris@16
|
317
|
Chris@16
|
318 # elif ULONG_MAX != 0xffffffff
|
Chris@16
|
319
|
Chris@16
|
320 # if ULONG_MAX == 18446744073709551615 // 2**64 - 1
|
Chris@16
|
321 typedef long intmax_t;
|
Chris@16
|
322 typedef unsigned long uintmax_t;
|
Chris@16
|
323 typedef long int64_t;
|
Chris@16
|
324 typedef long int_least64_t;
|
Chris@16
|
325 typedef long int_fast64_t;
|
Chris@16
|
326 typedef unsigned long uint64_t;
|
Chris@16
|
327 typedef unsigned long uint_least64_t;
|
Chris@16
|
328 typedef unsigned long uint_fast64_t;
|
Chris@16
|
329 # else
|
Chris@16
|
330 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
331 # endif
|
Chris@16
|
332 # elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG)
|
Chris@16
|
333 __extension__ typedef long long intmax_t;
|
Chris@16
|
334 __extension__ typedef unsigned long long uintmax_t;
|
Chris@16
|
335 __extension__ typedef long long int64_t;
|
Chris@16
|
336 __extension__ typedef long long int_least64_t;
|
Chris@16
|
337 __extension__ typedef long long int_fast64_t;
|
Chris@16
|
338 __extension__ typedef unsigned long long uint64_t;
|
Chris@16
|
339 __extension__ typedef unsigned long long uint_least64_t;
|
Chris@16
|
340 __extension__ typedef unsigned long long uint_fast64_t;
|
Chris@16
|
341 # elif defined(BOOST_HAS_MS_INT64)
|
Chris@16
|
342 //
|
Chris@16
|
343 // we have Borland/Intel/Microsoft __int64:
|
Chris@16
|
344 //
|
Chris@16
|
345 typedef __int64 intmax_t;
|
Chris@16
|
346 typedef unsigned __int64 uintmax_t;
|
Chris@16
|
347 typedef __int64 int64_t;
|
Chris@16
|
348 typedef __int64 int_least64_t;
|
Chris@16
|
349 typedef __int64 int_fast64_t;
|
Chris@16
|
350 typedef unsigned __int64 uint64_t;
|
Chris@16
|
351 typedef unsigned __int64 uint_least64_t;
|
Chris@16
|
352 typedef unsigned __int64 uint_fast64_t;
|
Chris@16
|
353 # else // assume no 64-bit integers
|
Chris@16
|
354 # define BOOST_NO_INT64_T
|
Chris@16
|
355 typedef int32_t intmax_t;
|
Chris@16
|
356 typedef uint32_t uintmax_t;
|
Chris@16
|
357 # endif
|
Chris@16
|
358
|
Chris@16
|
359 } // namespace boost
|
Chris@16
|
360
|
Chris@16
|
361
|
Chris@16
|
362 #endif // BOOST_HAS_STDINT_H
|
Chris@16
|
363
|
Chris@16
|
364 // intptr_t/uintptr_t are defined separately because they are optional and not universally available
|
Chris@16
|
365 #if defined(BOOST_WINDOWS) && !defined(_WIN32_WCE) && !defined(BOOST_HAS_STDINT_H)
|
Chris@16
|
366 // Older MSVC don't have stdint.h and have intptr_t/uintptr_t defined in stddef.h
|
Chris@16
|
367 #include <stddef.h>
|
Chris@16
|
368 #endif
|
Chris@16
|
369
|
Chris@16
|
370 // PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config.
|
Chris@16
|
371 #if !defined(__PGIC__)
|
Chris@16
|
372
|
Chris@16
|
373 #if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
|
Chris@16
|
374 || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
|
Chris@16
|
375 || defined(__CYGWIN__) \
|
Chris@16
|
376 || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
|
Chris@101
|
377 || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(sun)
|
Chris@16
|
378
|
Chris@16
|
379 namespace boost {
|
Chris@16
|
380 using ::intptr_t;
|
Chris@16
|
381 using ::uintptr_t;
|
Chris@16
|
382 }
|
Chris@16
|
383 #define BOOST_HAS_INTPTR_T
|
Chris@16
|
384
|
Chris@16
|
385 // Clang pretends to be GCC, so it'll match this condition
|
Chris@16
|
386 #elif defined(__GNUC__) && defined(__INTPTR_TYPE__) && defined(__UINTPTR_TYPE__)
|
Chris@16
|
387
|
Chris@16
|
388 namespace boost {
|
Chris@16
|
389 typedef __INTPTR_TYPE__ intptr_t;
|
Chris@16
|
390 typedef __UINTPTR_TYPE__ uintptr_t;
|
Chris@16
|
391 }
|
Chris@16
|
392 #define BOOST_HAS_INTPTR_T
|
Chris@16
|
393
|
Chris@16
|
394 #endif
|
Chris@16
|
395
|
Chris@16
|
396 #endif // !defined(__PGIC__)
|
Chris@16
|
397
|
Chris@16
|
398 #endif // BOOST_CSTDINT_HPP
|
Chris@16
|
399
|
Chris@16
|
400
|
Chris@16
|
401 /****************************************************
|
Chris@16
|
402
|
Chris@16
|
403 Macro definition section:
|
Chris@16
|
404
|
Chris@16
|
405 Added 23rd September 2000 (John Maddock).
|
Chris@16
|
406 Modified 11th September 2001 to be excluded when
|
Chris@16
|
407 BOOST_HAS_STDINT_H is defined (John Maddock).
|
Chris@16
|
408 Modified 11th Dec 2009 to always define the
|
Chris@16
|
409 INT#_C macros if they're not already defined (John Maddock).
|
Chris@16
|
410
|
Chris@16
|
411 ******************************************************/
|
Chris@16
|
412
|
Chris@16
|
413 #if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
|
Chris@16
|
414 (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
|
Chris@16
|
415 //
|
Chris@16
|
416 // For the following code we get several warnings along the lines of:
|
Chris@16
|
417 //
|
Chris@16
|
418 // boost/cstdint.hpp:428:35: error: use of C99 long long integer constant
|
Chris@16
|
419 //
|
Chris@16
|
420 // So we declare this a system header to suppress these warnings.
|
Chris@16
|
421 //
|
Chris@16
|
422 #if defined(__GNUC__) && (__GNUC__ >= 4)
|
Chris@16
|
423 #pragma GCC system_header
|
Chris@16
|
424 #endif
|
Chris@16
|
425
|
Chris@16
|
426 #include <limits.h>
|
Chris@16
|
427 # define BOOST__STDC_CONSTANT_MACROS_DEFINED
|
Chris@16
|
428 # if defined(BOOST_HAS_MS_INT64)
|
Chris@16
|
429 //
|
Chris@16
|
430 // Borland/Intel/Microsoft compilers have width specific suffixes:
|
Chris@16
|
431 //
|
Chris@16
|
432 #ifndef INT8_C
|
Chris@16
|
433 # define INT8_C(value) value##i8
|
Chris@16
|
434 #endif
|
Chris@16
|
435 #ifndef INT16_C
|
Chris@16
|
436 # define INT16_C(value) value##i16
|
Chris@16
|
437 #endif
|
Chris@16
|
438 #ifndef INT32_C
|
Chris@16
|
439 # define INT32_C(value) value##i32
|
Chris@16
|
440 #endif
|
Chris@16
|
441 #ifndef INT64_C
|
Chris@16
|
442 # define INT64_C(value) value##i64
|
Chris@16
|
443 #endif
|
Chris@16
|
444 # ifdef __BORLANDC__
|
Chris@16
|
445 // Borland bug: appending ui8 makes the type a signed char
|
Chris@16
|
446 # define UINT8_C(value) static_cast<unsigned char>(value##u)
|
Chris@16
|
447 # else
|
Chris@16
|
448 # define UINT8_C(value) value##ui8
|
Chris@16
|
449 # endif
|
Chris@16
|
450 #ifndef UINT16_C
|
Chris@16
|
451 # define UINT16_C(value) value##ui16
|
Chris@16
|
452 #endif
|
Chris@16
|
453 #ifndef UINT32_C
|
Chris@16
|
454 # define UINT32_C(value) value##ui32
|
Chris@16
|
455 #endif
|
Chris@16
|
456 #ifndef UINT64_C
|
Chris@16
|
457 # define UINT64_C(value) value##ui64
|
Chris@16
|
458 #endif
|
Chris@16
|
459 #ifndef INTMAX_C
|
Chris@16
|
460 # define INTMAX_C(value) value##i64
|
Chris@16
|
461 # define UINTMAX_C(value) value##ui64
|
Chris@16
|
462 #endif
|
Chris@16
|
463
|
Chris@16
|
464 # else
|
Chris@16
|
465 // do it the old fashioned way:
|
Chris@16
|
466
|
Chris@16
|
467 // 8-bit types ------------------------------------------------------------//
|
Chris@16
|
468
|
Chris@16
|
469 # if (UCHAR_MAX == 0xff) && !defined(INT8_C)
|
Chris@16
|
470 # define INT8_C(value) static_cast<boost::int8_t>(value)
|
Chris@16
|
471 # define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
|
Chris@16
|
472 # endif
|
Chris@16
|
473
|
Chris@16
|
474 // 16-bit types -----------------------------------------------------------//
|
Chris@16
|
475
|
Chris@16
|
476 # if (USHRT_MAX == 0xffff) && !defined(INT16_C)
|
Chris@16
|
477 # define INT16_C(value) static_cast<boost::int16_t>(value)
|
Chris@16
|
478 # define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
|
Chris@16
|
479 # endif
|
Chris@16
|
480
|
Chris@16
|
481 // 32-bit types -----------------------------------------------------------//
|
Chris@16
|
482 #ifndef INT32_C
|
Chris@16
|
483 # if (UINT_MAX == 0xffffffff)
|
Chris@16
|
484 # define INT32_C(value) value
|
Chris@16
|
485 # define UINT32_C(value) value##u
|
Chris@16
|
486 # elif ULONG_MAX == 0xffffffff
|
Chris@16
|
487 # define INT32_C(value) value##L
|
Chris@16
|
488 # define UINT32_C(value) value##uL
|
Chris@16
|
489 # endif
|
Chris@16
|
490 #endif
|
Chris@16
|
491
|
Chris@16
|
492 // 64-bit types + intmax_t and uintmax_t ----------------------------------//
|
Chris@16
|
493 #ifndef INT64_C
|
Chris@16
|
494 # if defined(BOOST_HAS_LONG_LONG) && \
|
Chris@101
|
495 (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_ULLONG_MAX) || defined(_LLONG_MAX))
|
Chris@16
|
496
|
Chris@16
|
497 # if defined(__hpux)
|
Chris@16
|
498 // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
|
Chris@16
|
499 # define INT64_C(value) value##LL
|
Chris@16
|
500 # define UINT64_C(value) value##uLL
|
Chris@16
|
501 # elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \
|
Chris@16
|
502 (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \
|
Chris@16
|
503 (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
|
Chris@101
|
504 (defined(_ULLONG_MAX) && _ULLONG_MAX == 18446744073709551615ULL) || \
|
Chris@101
|
505 (defined(_LLONG_MAX) && _LLONG_MAX == 9223372036854775807LL)
|
Chris@16
|
506
|
Chris@16
|
507 # define INT64_C(value) value##LL
|
Chris@16
|
508 # define UINT64_C(value) value##uLL
|
Chris@16
|
509 # else
|
Chris@16
|
510 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
511 # endif
|
Chris@16
|
512 # elif ULONG_MAX != 0xffffffff
|
Chris@16
|
513
|
Chris@16
|
514 # if ULONG_MAX == 18446744073709551615U // 2**64 - 1
|
Chris@16
|
515 # define INT64_C(value) value##L
|
Chris@16
|
516 # define UINT64_C(value) value##uL
|
Chris@16
|
517 # else
|
Chris@16
|
518 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
519 # endif
|
Chris@16
|
520 # elif defined(BOOST_HAS_LONG_LONG)
|
Chris@16
|
521 // Usual macros not defined, work things out for ourselves:
|
Chris@16
|
522 # if(~0uLL == 18446744073709551615ULL)
|
Chris@16
|
523 # define INT64_C(value) value##LL
|
Chris@16
|
524 # define UINT64_C(value) value##uLL
|
Chris@16
|
525 # else
|
Chris@16
|
526 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
527 # endif
|
Chris@16
|
528 # else
|
Chris@16
|
529 # error defaults not correct; you must hand modify boost/cstdint.hpp
|
Chris@16
|
530 # endif
|
Chris@16
|
531
|
Chris@16
|
532 # ifdef BOOST_NO_INT64_T
|
Chris@16
|
533 # define INTMAX_C(value) INT32_C(value)
|
Chris@16
|
534 # define UINTMAX_C(value) UINT32_C(value)
|
Chris@16
|
535 # else
|
Chris@16
|
536 # define INTMAX_C(value) INT64_C(value)
|
Chris@16
|
537 # define UINTMAX_C(value) UINT64_C(value)
|
Chris@16
|
538 # endif
|
Chris@16
|
539 #endif
|
Chris@16
|
540 # endif // Borland/Microsoft specific width suffixes
|
Chris@16
|
541
|
Chris@16
|
542 #endif // INT#_C macros.
|
Chris@16
|
543
|
Chris@16
|
544
|
Chris@16
|
545
|
Chris@16
|
546
|