23 #ifndef BOOST_CSTDINT_HPP
24 #define BOOST_CSTDINT_HPP
32 #ifndef __STDC_CONSTANT_MACROS
33 # define __STDC_CONSTANT_MACROS
44 #if defined(BOOST_HAS_STDINT_H) \
45 && (!defined(__GLIBC__) \
46 || defined(__GLIBC_HAVE_LONG_LONG) \
47 || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))
52 # include <inttypes.h>
53 # ifdef __STDC_32_MODE__
55 # define BOOST_NO_INT64_T
57 # elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
58 # include <inttypes.h>
63 # if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__)
66 # define INTMAX_C(c) c##LL
67 # define UINTMAX_C(c) c##ULL
72 #if defined(__QNX__) && defined(__EXT_QNX)
77 typedef ::intleast8_t int_least8_t;
78 typedef ::intfast8_t int_fast8_t;
79 typedef ::uintleast8_t uint_least8_t;
80 typedef ::uintfast8_t uint_fast8_t;
82 typedef ::intleast16_t int_least16_t;
83 typedef ::intfast16_t int_fast16_t;
84 typedef ::uintleast16_t uint_least16_t;
85 typedef ::uintfast16_t uint_fast16_t;
87 typedef ::intleast32_t int_least32_t;
88 typedef ::intfast32_t int_fast32_t;
89 typedef ::uintleast32_t uint_least32_t;
90 typedef ::uintfast32_t uint_fast32_t;
92 # ifndef BOOST_NO_INT64_T
94 typedef ::intleast64_t int_least64_t;
95 typedef ::intfast64_t int_fast64_t;
96 typedef ::uintleast64_t uint_least64_t;
97 typedef ::uintfast64_t uint_fast64_t;
107 using ::int_least8_t;
110 using ::uint_least8_t;
111 using ::uint_fast8_t;
114 using ::int_least16_t;
115 using ::int_fast16_t;
117 using ::uint_least16_t;
118 using ::uint_fast16_t;
121 using ::int_least32_t;
122 using ::int_fast32_t;
124 using ::uint_least32_t;
125 using ::uint_fast32_t;
127 # ifndef BOOST_NO_INT64_T
130 using ::int_least64_t;
131 using ::int_fast64_t;
133 using ::uint_least64_t;
134 using ::uint_fast64_t;
143 #elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) || defined(__VMS) || defined(__SOLARIS9__) || defined(__NetBSD__)
145 # include <inttypes.h>
150 typedef int8_t int_least8_t;
151 typedef int8_t int_fast8_t;
153 typedef uint8_t uint_least8_t;
154 typedef uint8_t uint_fast8_t;
157 typedef int16_t int_least16_t;
158 typedef int16_t int_fast16_t;
160 typedef uint16_t uint_least16_t;
161 typedef uint16_t uint_fast16_t;
164 typedef int32_t int_least32_t;
165 typedef int32_t int_fast32_t;
167 typedef uint32_t uint_least32_t;
168 typedef uint32_t uint_fast32_t;
170 # ifndef BOOST_NO_INT64_T
173 typedef int64_t int_least64_t;
174 typedef int64_t int_fast64_t;
176 typedef uint64_t uint_least64_t;
177 typedef uint64_t uint_fast64_t;
179 typedef int64_t intmax_t;
180 typedef uint64_t uintmax_t;
184 typedef int32_t intmax_t;
185 typedef uint32_t uintmax_t;
191 #else // BOOST_HAS_STDINT_H
210 # if UCHAR_MAX == 0xff
211 typedef signed char int8_t;
212 typedef signed char int_least8_t;
213 typedef signed char int_fast8_t;
214 typedef unsigned char uint8_t;
215 typedef unsigned char uint_least8_t;
216 typedef unsigned char uint_fast8_t;
218 # error defaults not correct; you must hand modify boost/cstdint.hpp
223 # if USHRT_MAX == 0xffff
224 # if defined(__crayx1)
227 typedef short int16_t;
228 typedef short int_least16_t;
229 typedef int int_fast16_t;
230 typedef unsigned short uint16_t;
231 typedef unsigned short uint_least16_t;
232 typedef unsigned int uint_fast16_t;
234 typedef short int16_t;
235 typedef short int_least16_t;
236 typedef short int_fast16_t;
237 typedef unsigned short uint16_t;
238 typedef unsigned short uint_least16_t;
239 typedef unsigned short uint_fast16_t;
241 # elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
244 typedef __short16 int16_t;
245 typedef __short16 int_least16_t;
246 typedef __short16 int_fast16_t;
247 typedef unsigned __short16 uint16_t;
248 typedef unsigned __short16 uint_least16_t;
249 typedef unsigned __short16 uint_fast16_t;
250 # elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
252 typedef short int_least16_t;
253 typedef short int_fast16_t;
254 typedef unsigned short uint_least16_t;
255 typedef unsigned short uint_fast16_t;
257 # error defaults not correct; you must hand modify boost/cstdint.hpp
262 # if UINT_MAX == 0xffffffff
264 typedef int int_least32_t;
265 typedef int int_fast32_t;
266 typedef unsigned int uint32_t;
267 typedef unsigned int uint_least32_t;
268 typedef unsigned int uint_fast32_t;
269 # elif (USHRT_MAX == 0xffffffff)
270 typedef short int32_t;
271 typedef short int_least32_t;
272 typedef short int_fast32_t;
273 typedef unsigned short uint32_t;
274 typedef unsigned short uint_least32_t;
275 typedef unsigned short uint_fast32_t;
276 # elif ULONG_MAX == 0xffffffff
277 typedef long int32_t;
278 typedef long int_least32_t;
279 typedef long int_fast32_t;
280 typedef unsigned long uint32_t;
281 typedef unsigned long uint_least32_t;
282 typedef unsigned long uint_fast32_t;
283 # elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
285 typedef __int32 int32_t;
286 typedef __int32 int_least32_t;
287 typedef __int32 int_fast32_t;
288 typedef unsigned __int32 uint32_t;
289 typedef unsigned __int32 uint_least32_t;
290 typedef unsigned __int32 uint_fast32_t;
292 # error defaults not correct; you must hand modify boost/cstdint.hpp
297 # if defined(BOOST_HAS_LONG_LONG) && \
298 !defined(BOOST_MSVC) && !defined(__BORLANDC__) && \
299 (!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \
300 (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
303 # elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL)
306 # error defaults not correct; you must hand modify boost/cstdint.hpp
309 typedef ::boost::long_long_type intmax_t;
310 typedef ::boost::ulong_long_type uintmax_t;
311 typedef ::boost::long_long_type int64_t;
312 typedef ::boost::long_long_type int_least64_t;
313 typedef ::boost::long_long_type int_fast64_t;
314 typedef ::boost::ulong_long_type uint64_t;
315 typedef ::boost::ulong_long_type uint_least64_t;
316 typedef ::boost::ulong_long_type uint_fast64_t;
318 # elif ULONG_MAX != 0xffffffff
320 # if ULONG_MAX == 18446744073709551615 // 2**64 - 1
321 typedef long intmax_t;
322 typedef unsigned long uintmax_t;
323 typedef long int64_t;
324 typedef long int_least64_t;
325 typedef long int_fast64_t;
326 typedef unsigned long uint64_t;
327 typedef unsigned long uint_least64_t;
328 typedef unsigned long uint_fast64_t;
330 # error defaults not correct; you must hand modify boost/cstdint.hpp
332 # elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG)
341 # elif defined(BOOST_HAS_MS_INT64)
345 typedef __int64 intmax_t;
346 typedef unsigned __int64 uintmax_t;
347 typedef __int64 int64_t;
348 typedef __int64 int_least64_t;
349 typedef __int64 int_fast64_t;
350 typedef unsigned __int64 uint64_t;
351 typedef unsigned __int64 uint_least64_t;
352 typedef unsigned __int64 uint_fast64_t;
353 # else // assume no 64-bit integers
354 # define BOOST_NO_INT64_T
355 typedef int32_t intmax_t;
356 typedef uint32_t uintmax_t;
362 #endif // BOOST_HAS_STDINT_H
365 #if defined(BOOST_WINDOWS) && !defined(_WIN32_WCE) && !defined(BOOST_HAS_STDINT_H)
371 #if !defined(__PGIC__)
373 #if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
374 || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
375 || defined(__CYGWIN__) \
376 || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
377 || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(sun)
383 #define BOOST_HAS_INTPTR_T
386 #elif defined(__GNUC__) && defined(__INTPTR_TYPE__) && defined(__UINTPTR_TYPE__)
389 typedef __INTPTR_TYPE__ intptr_t;
390 typedef __UINTPTR_TYPE__ uintptr_t;
392 #define BOOST_HAS_INTPTR_T
396 #endif // !defined(__PGIC__)
398 #endif // BOOST_CSTDINT_HPP
413 #if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
414 (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
422 #if defined(__GNUC__) && (__GNUC__ >= 4)
423 #pragma GCC system_header
427 # define BOOST__STDC_CONSTANT_MACROS_DEFINED
428 # if defined(BOOST_HAS_MS_INT64)
433 # define INT8_C(value) value##i8
436 # define INT16_C(value) value##i16
439 # define INT32_C(value) value##i32
442 # define INT64_C(value) value##i64
446 # define UINT8_C(value) static_cast<unsigned char>(value##u)
448 # define UINT8_C(value) value##ui8
451 # define UINT16_C(value) value##ui16
454 # define UINT32_C(value) value##ui32
457 # define UINT64_C(value) value##ui64
460 # define INTMAX_C(value) value##i64
461 # define UINTMAX_C(value) value##ui64
469 # if (UCHAR_MAX == 0xff) && !defined(INT8_C)
470 # define INT8_C(value) static_cast<boost::int8_t>(value)
471 # define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
476 # if (USHRT_MAX == 0xffff) && !defined(INT16_C)
477 # define INT16_C(value) static_cast<boost::int16_t>(value)
478 # define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
483 # if (UINT_MAX == 0xffffffff)
484 # define INT32_C(value) value
485 # define UINT32_C(value) value##u
486 # elif ULONG_MAX == 0xffffffff
487 # define INT32_C(value) value##L
488 # define UINT32_C(value) value##uL
494 # if defined(BOOST_HAS_LONG_LONG) && \
495 (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_ULLONG_MAX) || defined(_LLONG_MAX))
499 # define INT64_C(value) value##LL
500 # define UINT64_C(value) value##uLL
501 # elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \
502 (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \
503 (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
504 (defined(_ULLONG_MAX) && _ULLONG_MAX == 18446744073709551615ULL) || \
505 (defined(_LLONG_MAX) && _LLONG_MAX == 9223372036854775807LL)
507 # define INT64_C(value) value##LL
508 # define UINT64_C(value) value##uLL
510 # error defaults not correct; you must hand modify boost/cstdint.hpp
512 # elif ULONG_MAX != 0xffffffff
514 # if ULONG_MAX == 18446744073709551615U // 2**64 - 1
515 # define INT64_C(value) value##L
516 # define UINT64_C(value) value##uL
518 # error defaults not correct; you must hand modify boost/cstdint.hpp
520 # elif defined(BOOST_HAS_LONG_LONG)
522 # if(~0uLL == 18446744073709551615ULL)
523 # define INT64_C(value) value##LL
524 # define UINT64_C(value) value##uLL
526 # error defaults not correct; you must hand modify boost/cstdint.hpp
529 # error defaults not correct; you must hand modify boost/cstdint.hpp
532 # ifdef BOOST_NO_INT64_T
533 # define INTMAX_C(value) INT32_C(value)
534 # define UINTMAX_C(value) UINT32_C(value)
536 # define INTMAX_C(value) INT64_C(value)
537 # define UINTMAX_C(value) UINT64_C(value)
540 # endif // Borland/Microsoft specific width suffixes
542 #endif // INT#_C macros.