author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:27:01 +0100 | |
branch | Symbian2 |
changeset 3 | e1b950c65cb4 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
// boost cstdint.hpp header file ------------------------------------------// |
williamr@2 | 2 |
|
williamr@2 | 3 |
// (C) Copyright Beman Dawes 1999. |
williamr@2 | 4 |
// (C) Copyright Jens Mauer 2001 |
williamr@2 | 5 |
// (C) Copyright John Maddock 2001 |
williamr@2 | 6 |
// Distributed under the Boost |
williamr@2 | 7 |
// Software License, Version 1.0. (See accompanying file |
williamr@2 | 8 |
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
williamr@2 | 9 |
|
williamr@2 | 10 |
// See http://www.boost.org/libs/integer for documentation. |
williamr@2 | 11 |
|
williamr@2 | 12 |
// Revision History |
williamr@2 | 13 |
// 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.) |
williamr@2 | 14 |
// 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer) |
williamr@2 | 15 |
// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer) |
williamr@2 | 16 |
// 12 Nov 00 Merged <boost/stdint.h> (Jens Maurer) |
williamr@2 | 17 |
// 23 Sep 00 Added INTXX_C macro support (John Maddock). |
williamr@2 | 18 |
// 22 Sep 00 Better 64-bit support (John Maddock) |
williamr@2 | 19 |
// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost |
williamr@2 | 20 |
// 8 Aug 99 Initial version (Beman Dawes) |
williamr@2 | 21 |
|
williamr@2 | 22 |
|
williamr@2 | 23 |
#ifndef BOOST_CSTDINT_HPP |
williamr@2 | 24 |
#define BOOST_CSTDINT_HPP |
williamr@2 | 25 |
|
williamr@2 | 26 |
#include <boost/config.hpp> |
williamr@2 | 27 |
|
williamr@2 | 28 |
|
williamr@2 | 29 |
#ifdef BOOST_HAS_STDINT_H |
williamr@2 | 30 |
|
williamr@2 | 31 |
// The following #include is an implementation artifact; not part of interface. |
williamr@2 | 32 |
# ifdef __hpux |
williamr@2 | 33 |
// HP-UX has a vaguely nice <stdint.h> in a non-standard location |
williamr@2 | 34 |
# include <inttypes.h> |
williamr@2 | 35 |
# ifdef __STDC_32_MODE__ |
williamr@2 | 36 |
// this is triggered with GCC, because it defines __cplusplus < 199707L |
williamr@2 | 37 |
# define BOOST_NO_INT64_T |
williamr@2 | 38 |
# endif |
williamr@2 | 39 |
# elif defined(__FreeBSD__) || defined(__IBMCPP__) |
williamr@2 | 40 |
# include <inttypes.h> |
williamr@2 | 41 |
# else |
williamr@2 | 42 |
# include <stdint.h> |
williamr@2 | 43 |
|
williamr@2 | 44 |
// There is a bug in Cygwin two _C macros |
williamr@2 | 45 |
# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__) |
williamr@2 | 46 |
# undef INTMAX_C |
williamr@2 | 47 |
# undef UINTMAX_C |
williamr@2 | 48 |
# define INTMAX_C(c) c##LL |
williamr@2 | 49 |
# define UINTMAX_C(c) c##ULL |
williamr@2 | 50 |
# endif |
williamr@2 | 51 |
|
williamr@2 | 52 |
# endif |
williamr@2 | 53 |
|
williamr@2 | 54 |
#ifdef __QNX__ |
williamr@2 | 55 |
|
williamr@2 | 56 |
// QNX (Dinkumware stdlib) defines these as non-standard names. |
williamr@2 | 57 |
// Reflect to the standard names. |
williamr@2 | 58 |
|
williamr@2 | 59 |
typedef ::intleast8_t int_least8_t; |
williamr@2 | 60 |
typedef ::intfast8_t int_fast8_t; |
williamr@2 | 61 |
typedef ::uintleast8_t uint_least8_t; |
williamr@2 | 62 |
typedef ::uintfast8_t uint_fast8_t; |
williamr@2 | 63 |
|
williamr@2 | 64 |
typedef ::intleast16_t int_least16_t; |
williamr@2 | 65 |
typedef ::intfast16_t int_fast16_t; |
williamr@2 | 66 |
typedef ::uintleast16_t uint_least16_t; |
williamr@2 | 67 |
typedef ::uintfast16_t uint_fast16_t; |
williamr@2 | 68 |
|
williamr@2 | 69 |
typedef ::intleast32_t int_least32_t; |
williamr@2 | 70 |
typedef ::intfast32_t int_fast32_t; |
williamr@2 | 71 |
typedef ::uintleast32_t uint_least32_t; |
williamr@2 | 72 |
typedef ::uintfast32_t uint_fast32_t; |
williamr@2 | 73 |
|
williamr@2 | 74 |
# ifndef BOOST_NO_INT64_T |
williamr@2 | 75 |
|
williamr@2 | 76 |
typedef ::intleast64_t int_least64_t; |
williamr@2 | 77 |
typedef ::intfast64_t int_fast64_t; |
williamr@2 | 78 |
typedef ::uintleast64_t uint_least64_t; |
williamr@2 | 79 |
typedef ::uintfast64_t uint_fast64_t; |
williamr@2 | 80 |
|
williamr@2 | 81 |
# endif |
williamr@2 | 82 |
|
williamr@2 | 83 |
#endif |
williamr@2 | 84 |
|
williamr@2 | 85 |
namespace boost |
williamr@2 | 86 |
{ |
williamr@2 | 87 |
|
williamr@2 | 88 |
using ::int8_t; |
williamr@2 | 89 |
using ::int_least8_t; |
williamr@2 | 90 |
using ::int_fast8_t; |
williamr@2 | 91 |
using ::uint8_t; |
williamr@2 | 92 |
using ::uint_least8_t; |
williamr@2 | 93 |
using ::uint_fast8_t; |
williamr@2 | 94 |
|
williamr@2 | 95 |
using ::int16_t; |
williamr@2 | 96 |
using ::int_least16_t; |
williamr@2 | 97 |
using ::int_fast16_t; |
williamr@2 | 98 |
using ::uint16_t; |
williamr@2 | 99 |
using ::uint_least16_t; |
williamr@2 | 100 |
using ::uint_fast16_t; |
williamr@2 | 101 |
|
williamr@2 | 102 |
using ::int32_t; |
williamr@2 | 103 |
using ::int_least32_t; |
williamr@2 | 104 |
using ::int_fast32_t; |
williamr@2 | 105 |
using ::uint32_t; |
williamr@2 | 106 |
using ::uint_least32_t; |
williamr@2 | 107 |
using ::uint_fast32_t; |
williamr@2 | 108 |
|
williamr@2 | 109 |
# ifndef BOOST_NO_INT64_T |
williamr@2 | 110 |
|
williamr@2 | 111 |
using ::int64_t; |
williamr@2 | 112 |
using ::int_least64_t; |
williamr@2 | 113 |
using ::int_fast64_t; |
williamr@2 | 114 |
using ::uint64_t; |
williamr@2 | 115 |
using ::uint_least64_t; |
williamr@2 | 116 |
using ::uint_fast64_t; |
williamr@2 | 117 |
|
williamr@2 | 118 |
# endif |
williamr@2 | 119 |
|
williamr@2 | 120 |
using ::intmax_t; |
williamr@2 | 121 |
using ::uintmax_t; |
williamr@2 | 122 |
|
williamr@2 | 123 |
} // namespace boost |
williamr@2 | 124 |
|
williamr@2 | 125 |
#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) |
williamr@2 | 126 |
// FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need. |
williamr@2 | 127 |
# include <inttypes.h> |
williamr@2 | 128 |
|
williamr@2 | 129 |
namespace boost { |
williamr@2 | 130 |
|
williamr@2 | 131 |
using ::int8_t; |
williamr@2 | 132 |
typedef int8_t int_least8_t; |
williamr@2 | 133 |
typedef int8_t int_fast8_t; |
williamr@2 | 134 |
using ::uint8_t; |
williamr@2 | 135 |
typedef uint8_t uint_least8_t; |
williamr@2 | 136 |
typedef uint8_t uint_fast8_t; |
williamr@2 | 137 |
|
williamr@2 | 138 |
using ::int16_t; |
williamr@2 | 139 |
typedef int16_t int_least16_t; |
williamr@2 | 140 |
typedef int16_t int_fast16_t; |
williamr@2 | 141 |
using ::uint16_t; |
williamr@2 | 142 |
typedef uint16_t uint_least16_t; |
williamr@2 | 143 |
typedef uint16_t uint_fast16_t; |
williamr@2 | 144 |
|
williamr@2 | 145 |
using ::int32_t; |
williamr@2 | 146 |
typedef int32_t int_least32_t; |
williamr@2 | 147 |
typedef int32_t int_fast32_t; |
williamr@2 | 148 |
using ::uint32_t; |
williamr@2 | 149 |
typedef uint32_t uint_least32_t; |
williamr@2 | 150 |
typedef uint32_t uint_fast32_t; |
williamr@2 | 151 |
|
williamr@2 | 152 |
# ifndef BOOST_NO_INT64_T |
williamr@2 | 153 |
|
williamr@2 | 154 |
using ::int64_t; |
williamr@2 | 155 |
typedef int64_t int_least64_t; |
williamr@2 | 156 |
typedef int64_t int_fast64_t; |
williamr@2 | 157 |
using ::uint64_t; |
williamr@2 | 158 |
typedef uint64_t uint_least64_t; |
williamr@2 | 159 |
typedef uint64_t uint_fast64_t; |
williamr@2 | 160 |
|
williamr@2 | 161 |
typedef int64_t intmax_t; |
williamr@2 | 162 |
typedef uint64_t uintmax_t; |
williamr@2 | 163 |
|
williamr@2 | 164 |
# else |
williamr@2 | 165 |
|
williamr@2 | 166 |
typedef int32_t intmax_t; |
williamr@2 | 167 |
typedef uint32_t uintmax_t; |
williamr@2 | 168 |
|
williamr@2 | 169 |
# endif |
williamr@2 | 170 |
|
williamr@2 | 171 |
} // namespace boost |
williamr@2 | 172 |
|
williamr@2 | 173 |
#else // BOOST_HAS_STDINT_H |
williamr@2 | 174 |
|
williamr@2 | 175 |
# include <boost/limits.hpp> // implementation artifact; not part of interface |
williamr@2 | 176 |
# include <limits.h> // needed for limits macros |
williamr@2 | 177 |
|
williamr@2 | 178 |
|
williamr@2 | 179 |
namespace boost |
williamr@2 | 180 |
{ |
williamr@2 | 181 |
|
williamr@2 | 182 |
// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit |
williamr@2 | 183 |
// platforms. For other systems, they will have to be hand tailored. |
williamr@2 | 184 |
// |
williamr@2 | 185 |
// Because the fast types are assumed to be the same as the undecorated types, |
williamr@2 | 186 |
// it may be possible to hand tailor a more efficient implementation. Such |
williamr@2 | 187 |
// an optimization may be illusionary; on the Intel x86-family 386 on, for |
williamr@2 | 188 |
// example, byte arithmetic and load/stores are as fast as "int" sized ones. |
williamr@2 | 189 |
|
williamr@2 | 190 |
// 8-bit types ------------------------------------------------------------// |
williamr@2 | 191 |
|
williamr@2 | 192 |
# if UCHAR_MAX == 0xff |
williamr@2 | 193 |
typedef signed char int8_t; |
williamr@2 | 194 |
typedef signed char int_least8_t; |
williamr@2 | 195 |
typedef signed char int_fast8_t; |
williamr@2 | 196 |
typedef unsigned char uint8_t; |
williamr@2 | 197 |
typedef unsigned char uint_least8_t; |
williamr@2 | 198 |
typedef unsigned char uint_fast8_t; |
williamr@2 | 199 |
# else |
williamr@2 | 200 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 201 |
# endif |
williamr@2 | 202 |
|
williamr@2 | 203 |
// 16-bit types -----------------------------------------------------------// |
williamr@2 | 204 |
|
williamr@2 | 205 |
# if USHRT_MAX == 0xffff |
williamr@2 | 206 |
# if defined(__crayx1) |
williamr@2 | 207 |
// The Cray X1 has a 16-bit short, however it is not recommend |
williamr@2 | 208 |
// for use in performance critical code. |
williamr@2 | 209 |
typedef short int16_t; |
williamr@2 | 210 |
typedef short int_least16_t; |
williamr@2 | 211 |
typedef int int_fast16_t; |
williamr@2 | 212 |
typedef unsigned short uint16_t; |
williamr@2 | 213 |
typedef unsigned short uint_least16_t; |
williamr@2 | 214 |
typedef unsigned int uint_fast16_t; |
williamr@2 | 215 |
# else |
williamr@2 | 216 |
typedef short int16_t; |
williamr@2 | 217 |
typedef short int_least16_t; |
williamr@2 | 218 |
typedef short int_fast16_t; |
williamr@2 | 219 |
typedef unsigned short uint16_t; |
williamr@2 | 220 |
typedef unsigned short uint_least16_t; |
williamr@2 | 221 |
typedef unsigned short uint_fast16_t; |
williamr@2 | 222 |
# endif |
williamr@2 | 223 |
# elif (USHRT_MAX == 0xffffffff) && defined(CRAY) |
williamr@2 | 224 |
// no 16-bit types on Cray: |
williamr@2 | 225 |
typedef short int_least16_t; |
williamr@2 | 226 |
typedef short int_fast16_t; |
williamr@2 | 227 |
typedef unsigned short uint_least16_t; |
williamr@2 | 228 |
typedef unsigned short uint_fast16_t; |
williamr@2 | 229 |
# else |
williamr@2 | 230 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 231 |
# endif |
williamr@2 | 232 |
|
williamr@2 | 233 |
// 32-bit types -----------------------------------------------------------// |
williamr@2 | 234 |
|
williamr@2 | 235 |
# if ULONG_MAX == 0xffffffff |
williamr@2 | 236 |
typedef long int32_t; |
williamr@2 | 237 |
typedef long int_least32_t; |
williamr@2 | 238 |
typedef long int_fast32_t; |
williamr@2 | 239 |
typedef unsigned long uint32_t; |
williamr@2 | 240 |
typedef unsigned long uint_least32_t; |
williamr@2 | 241 |
typedef unsigned long uint_fast32_t; |
williamr@2 | 242 |
# elif UINT_MAX == 0xffffffff |
williamr@2 | 243 |
typedef int int32_t; |
williamr@2 | 244 |
typedef int int_least32_t; |
williamr@2 | 245 |
typedef int int_fast32_t; |
williamr@2 | 246 |
typedef unsigned int uint32_t; |
williamr@2 | 247 |
typedef unsigned int uint_least32_t; |
williamr@2 | 248 |
typedef unsigned int uint_fast32_t; |
williamr@2 | 249 |
# else |
williamr@2 | 250 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 251 |
# endif |
williamr@2 | 252 |
|
williamr@2 | 253 |
// 64-bit types + intmax_t and uintmax_t ----------------------------------// |
williamr@2 | 254 |
|
williamr@2 | 255 |
# if defined(BOOST_HAS_LONG_LONG) && \ |
williamr@2 | 256 |
!defined(BOOST_MSVC) && !defined(__BORLANDC__) && \ |
williamr@2 | 257 |
(!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \ |
williamr@2 | 258 |
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) |
williamr@2 | 259 |
# if defined(__hpux) |
williamr@2 | 260 |
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions |
williamr@2 | 261 |
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) |
williamr@2 | 262 |
// 2**64 - 1 |
williamr@2 | 263 |
# else |
williamr@2 | 264 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 265 |
# endif |
williamr@2 | 266 |
|
williamr@2 | 267 |
typedef ::boost::long_long_type intmax_t; |
williamr@2 | 268 |
typedef ::boost::ulong_long_type uintmax_t; |
williamr@2 | 269 |
typedef ::boost::long_long_type int64_t; |
williamr@2 | 270 |
typedef ::boost::long_long_type int_least64_t; |
williamr@2 | 271 |
typedef ::boost::long_long_type int_fast64_t; |
williamr@2 | 272 |
typedef ::boost::ulong_long_type uint64_t; |
williamr@2 | 273 |
typedef ::boost::ulong_long_type uint_least64_t; |
williamr@2 | 274 |
typedef ::boost::ulong_long_type uint_fast64_t; |
williamr@2 | 275 |
|
williamr@2 | 276 |
# elif ULONG_MAX != 0xffffffff |
williamr@2 | 277 |
|
williamr@2 | 278 |
# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 |
williamr@2 | 279 |
typedef long intmax_t; |
williamr@2 | 280 |
typedef unsigned long uintmax_t; |
williamr@2 | 281 |
typedef long int64_t; |
williamr@2 | 282 |
typedef long int_least64_t; |
williamr@2 | 283 |
typedef long int_fast64_t; |
williamr@2 | 284 |
typedef unsigned long uint64_t; |
williamr@2 | 285 |
typedef unsigned long uint_least64_t; |
williamr@2 | 286 |
typedef unsigned long uint_fast64_t; |
williamr@2 | 287 |
# else |
williamr@2 | 288 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 289 |
# endif |
williamr@2 | 290 |
# elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG) |
williamr@2 | 291 |
__extension__ typedef long long intmax_t; |
williamr@2 | 292 |
__extension__ typedef unsigned long long uintmax_t; |
williamr@2 | 293 |
__extension__ typedef long long int64_t; |
williamr@2 | 294 |
__extension__ typedef long long int_least64_t; |
williamr@2 | 295 |
__extension__ typedef long long int_fast64_t; |
williamr@2 | 296 |
__extension__ typedef unsigned long long uint64_t; |
williamr@2 | 297 |
__extension__ typedef unsigned long long uint_least64_t; |
williamr@2 | 298 |
__extension__ typedef unsigned long long uint_fast64_t; |
williamr@2 | 299 |
# elif defined(BOOST_HAS_MS_INT64) |
williamr@2 | 300 |
// |
williamr@2 | 301 |
// we have Borland/Intel/Microsoft __int64: |
williamr@2 | 302 |
// |
williamr@2 | 303 |
typedef __int64 intmax_t; |
williamr@2 | 304 |
typedef unsigned __int64 uintmax_t; |
williamr@2 | 305 |
typedef __int64 int64_t; |
williamr@2 | 306 |
typedef __int64 int_least64_t; |
williamr@2 | 307 |
typedef __int64 int_fast64_t; |
williamr@2 | 308 |
typedef unsigned __int64 uint64_t; |
williamr@2 | 309 |
typedef unsigned __int64 uint_least64_t; |
williamr@2 | 310 |
typedef unsigned __int64 uint_fast64_t; |
williamr@2 | 311 |
# else // assume no 64-bit integers |
williamr@2 | 312 |
# define BOOST_NO_INT64_T |
williamr@2 | 313 |
typedef int32_t intmax_t; |
williamr@2 | 314 |
typedef uint32_t uintmax_t; |
williamr@2 | 315 |
# endif |
williamr@2 | 316 |
|
williamr@2 | 317 |
} // namespace boost |
williamr@2 | 318 |
|
williamr@2 | 319 |
|
williamr@2 | 320 |
#endif // BOOST_HAS_STDINT_H |
williamr@2 | 321 |
|
williamr@2 | 322 |
#endif // BOOST_CSTDINT_HPP |
williamr@2 | 323 |
|
williamr@2 | 324 |
|
williamr@2 | 325 |
/**************************************************** |
williamr@2 | 326 |
|
williamr@2 | 327 |
Macro definition section: |
williamr@2 | 328 |
|
williamr@2 | 329 |
Define various INTXX_C macros only if |
williamr@2 | 330 |
__STDC_CONSTANT_MACROS is defined. |
williamr@2 | 331 |
|
williamr@2 | 332 |
Undefine the macros if __STDC_CONSTANT_MACROS is |
williamr@2 | 333 |
not defined and the macros are (cf <cassert>). |
williamr@2 | 334 |
|
williamr@2 | 335 |
Added 23rd September 2000 (John Maddock). |
williamr@2 | 336 |
Modified 11th September 2001 to be excluded when |
williamr@2 | 337 |
BOOST_HAS_STDINT_H is defined (John Maddock). |
williamr@2 | 338 |
|
williamr@2 | 339 |
******************************************************/ |
williamr@2 | 340 |
|
williamr@2 | 341 |
#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H) |
williamr@2 | 342 |
# define BOOST__STDC_CONSTANT_MACROS_DEFINED |
williamr@2 | 343 |
# if defined(BOOST_HAS_MS_INT64) |
williamr@2 | 344 |
// |
williamr@2 | 345 |
// Borland/Intel/Microsoft compilers have width specific suffixes: |
williamr@2 | 346 |
// |
williamr@2 | 347 |
# define INT8_C(value) value##i8 |
williamr@2 | 348 |
# define INT16_C(value) value##i16 |
williamr@2 | 349 |
# define INT32_C(value) value##i32 |
williamr@2 | 350 |
# define INT64_C(value) value##i64 |
williamr@2 | 351 |
# ifdef __BORLANDC__ |
williamr@2 | 352 |
// Borland bug: appending ui8 makes the type a signed char |
williamr@2 | 353 |
# define UINT8_C(value) static_cast<unsigned char>(value##u) |
williamr@2 | 354 |
# else |
williamr@2 | 355 |
# define UINT8_C(value) value##ui8 |
williamr@2 | 356 |
# endif |
williamr@2 | 357 |
# define UINT16_C(value) value##ui16 |
williamr@2 | 358 |
# define UINT32_C(value) value##ui32 |
williamr@2 | 359 |
# define UINT64_C(value) value##ui64 |
williamr@2 | 360 |
# define INTMAX_C(value) value##i64 |
williamr@2 | 361 |
# define UINTMAX_C(value) value##ui64 |
williamr@2 | 362 |
|
williamr@2 | 363 |
# else |
williamr@2 | 364 |
// do it the old fashioned way: |
williamr@2 | 365 |
|
williamr@2 | 366 |
// 8-bit types ------------------------------------------------------------// |
williamr@2 | 367 |
|
williamr@2 | 368 |
# if UCHAR_MAX == 0xff |
williamr@2 | 369 |
# define INT8_C(value) static_cast<boost::int8_t>(value) |
williamr@2 | 370 |
# define UINT8_C(value) static_cast<boost::uint8_t>(value##u) |
williamr@2 | 371 |
# endif |
williamr@2 | 372 |
|
williamr@2 | 373 |
// 16-bit types -----------------------------------------------------------// |
williamr@2 | 374 |
|
williamr@2 | 375 |
# if USHRT_MAX == 0xffff |
williamr@2 | 376 |
# define INT16_C(value) static_cast<boost::int16_t>(value) |
williamr@2 | 377 |
# define UINT16_C(value) static_cast<boost::uint16_t>(value##u) |
williamr@2 | 378 |
# endif |
williamr@2 | 379 |
|
williamr@2 | 380 |
// 32-bit types -----------------------------------------------------------// |
williamr@2 | 381 |
|
williamr@2 | 382 |
# if UINT_MAX == 0xffffffff |
williamr@2 | 383 |
# define INT32_C(value) value |
williamr@2 | 384 |
# define UINT32_C(value) value##u |
williamr@2 | 385 |
# elif ULONG_MAX == 0xffffffff |
williamr@2 | 386 |
# define INT32_C(value) value##L |
williamr@2 | 387 |
# define UINT32_C(value) value##uL |
williamr@2 | 388 |
# endif |
williamr@2 | 389 |
|
williamr@2 | 390 |
// 64-bit types + intmax_t and uintmax_t ----------------------------------// |
williamr@2 | 391 |
|
williamr@2 | 392 |
# if defined(BOOST_HAS_LONG_LONG) && \ |
williamr@2 | 393 |
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) |
williamr@2 | 394 |
|
williamr@2 | 395 |
# if defined(__hpux) |
williamr@2 | 396 |
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions |
williamr@2 | 397 |
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \ |
williamr@2 | 398 |
(defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \ |
williamr@2 | 399 |
(defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U) |
williamr@2 | 400 |
|
williamr@2 | 401 |
# else |
williamr@2 | 402 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 403 |
# endif |
williamr@2 | 404 |
# define INT64_C(value) value##LL |
williamr@2 | 405 |
# define UINT64_C(value) value##uLL |
williamr@2 | 406 |
# elif ULONG_MAX != 0xffffffff |
williamr@2 | 407 |
|
williamr@2 | 408 |
# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 |
williamr@2 | 409 |
# define INT64_C(value) value##L |
williamr@2 | 410 |
# define UINT64_C(value) value##uL |
williamr@2 | 411 |
# else |
williamr@2 | 412 |
# error defaults not correct; you must hand modify boost/cstdint.hpp |
williamr@2 | 413 |
# endif |
williamr@2 | 414 |
# endif |
williamr@2 | 415 |
|
williamr@2 | 416 |
# ifdef BOOST_NO_INT64_T |
williamr@2 | 417 |
# define INTMAX_C(value) INT32_C(value) |
williamr@2 | 418 |
# define UINTMAX_C(value) UINT32_C(value) |
williamr@2 | 419 |
# else |
williamr@2 | 420 |
# define INTMAX_C(value) INT64_C(value) |
williamr@2 | 421 |
# define UINTMAX_C(value) UINT64_C(value) |
williamr@2 | 422 |
# endif |
williamr@2 | 423 |
|
williamr@2 | 424 |
# endif // Borland/Microsoft specific width suffixes |
williamr@2 | 425 |
|
williamr@2 | 426 |
|
williamr@2 | 427 |
#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H) |
williamr@2 | 428 |
// |
williamr@2 | 429 |
// undef all the macros: |
williamr@2 | 430 |
// |
williamr@2 | 431 |
# undef INT8_C |
williamr@2 | 432 |
# undef INT16_C |
williamr@2 | 433 |
# undef INT32_C |
williamr@2 | 434 |
# undef INT64_C |
williamr@2 | 435 |
# undef UINT8_C |
williamr@2 | 436 |
# undef UINT16_C |
williamr@2 | 437 |
# undef UINT32_C |
williamr@2 | 438 |
# undef UINT64_C |
williamr@2 | 439 |
# undef INTMAX_C |
williamr@2 | 440 |
# undef UINTMAX_C |
williamr@2 | 441 |
|
williamr@2 | 442 |
#endif // __STDC_CONSTANT_MACROS_DEFINED etc. |
williamr@2 | 443 |
|
williamr@2 | 444 |
|
williamr@2 | 445 |
|
williamr@2 | 446 |