~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to libs/boost-lib/boost/cstdint.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#ifndef BOOST_CSTDINT_HPP
24
24
#define BOOST_CSTDINT_HPP
25
25
 
 
26
//
 
27
// Since we always define the INT#_C macros as per C++0x, 
 
28
// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
 
29
// thing if possible, and so that the user knows that the macros 
 
30
// are actually defined as per C99.
 
31
//
 
32
#ifndef __STDC_CONSTANT_MACROS
 
33
#  define __STDC_CONSTANT_MACROS
 
34
#endif
 
35
 
26
36
#include <boost/config.hpp>
27
37
 
28
 
 
29
 
#ifdef BOOST_HAS_STDINT_H
 
38
//
 
39
// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
 
40
// depending upon what headers happen to have been included first...
 
41
// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
 
42
// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
 
43
//
 
44
#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
30
45
 
31
46
// The following #include is an implementation artifact; not part of interface.
32
47
# ifdef __hpux
36
51
      // this is triggered with GCC, because it defines __cplusplus < 199707L
37
52
#     define BOOST_NO_INT64_T
38
53
#   endif 
39
 
# elif defined(__FreeBSD__) || defined(__IBMCPP__)
 
54
# elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
40
55
#   include <inttypes.h>
41
56
# else
42
57
#   include <stdint.h>
173
188
#else  // BOOST_HAS_STDINT_H
174
189
 
175
190
# include <boost/limits.hpp> // implementation artifact; not part of interface
 
191
# include <limits.h>         // needed for limits macros
176
192
 
177
193
 
178
194
namespace boost
219
235
     typedef unsigned short  uint_least16_t;
220
236
     typedef unsigned short  uint_fast16_t;
221
237
#  endif
 
238
# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__) 
 
239
      // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified 
 
240
      // MTA / XMT does support the following non-standard integer types 
 
241
      typedef __short16           int16_t; 
 
242
      typedef __short16           int_least16_t; 
 
243
      typedef __short16           int_fast16_t; 
 
244
      typedef unsigned __short16  uint16_t; 
 
245
      typedef unsigned __short16  uint_least16_t; 
 
246
      typedef unsigned __short16  uint_fast16_t; 
222
247
# elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
223
248
     // no 16-bit types on Cray:
224
249
     typedef short           int_least16_t;
245
270
     typedef unsigned int    uint32_t;
246
271
     typedef unsigned int    uint_least32_t;
247
272
     typedef unsigned int    uint_fast32_t;
 
273
# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__) 
 
274
      // Integers are 64 bits on the MTA / XMT 
 
275
      typedef __int32           int32_t; 
 
276
      typedef __int32           int_least32_t; 
 
277
      typedef __int32           int_fast32_t; 
 
278
      typedef unsigned __int32  uint32_t; 
 
279
      typedef unsigned __int32  uint_least32_t; 
 
280
      typedef unsigned __int32  uint_fast32_t; 
248
281
# else
249
282
#    error defaults not correct; you must hand modify boost/cstdint.hpp
250
283
# endif
325
358
 
326
359
Macro definition section:
327
360
 
328
 
Define various INTXX_C macros only if
329
 
__STDC_CONSTANT_MACROS is defined.
330
 
 
331
 
Undefine the macros if __STDC_CONSTANT_MACROS is
332
 
not defined and the macros are (cf <cassert>).
333
 
 
334
361
Added 23rd September 2000 (John Maddock).
335
362
Modified 11th September 2001 to be excluded when
336
363
BOOST_HAS_STDINT_H is defined (John Maddock).
 
364
Modified 11th Dec 2009 to always define the
 
365
INT#_C macros if they're not already defined (John Maddock).
337
366
 
338
367
******************************************************/
339
368
 
340
 
#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H)
 
369
#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
 
370
   (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
 
371
//
 
372
// For the following code we get several warnings along the lines of: 
 
373
// 
 
374
// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant 
 
375
// 
 
376
// So we declare this a system header to suppress these warnings. 
 
377
//
 
378
#if defined(__GNUC__) && (__GNUC__ >= 4) 
 
379
#pragma GCC system_header 
 
380
#endif 
 
381
 
 
382
#include <limits.h>
341
383
# define BOOST__STDC_CONSTANT_MACROS_DEFINED
342
384
# if defined(BOOST_HAS_MS_INT64)
343
385
//
344
386
// Borland/Intel/Microsoft compilers have width specific suffixes:
345
387
//
 
388
#ifndef INT8_C
346
389
#  define INT8_C(value)     value##i8
 
390
#endif
 
391
#ifndef INT16_C
347
392
#  define INT16_C(value)    value##i16
 
393
#endif
 
394
#ifndef INT32_C
348
395
#  define INT32_C(value)    value##i32
 
396
#endif
 
397
#ifndef INT64_C
349
398
#  define INT64_C(value)    value##i64
 
399
#endif
350
400
#  ifdef __BORLANDC__
351
401
    // Borland bug: appending ui8 makes the type a signed char
352
402
#   define UINT8_C(value)    static_cast<unsigned char>(value##u)
353
403
#  else
354
404
#   define UINT8_C(value)    value##ui8
355
405
#  endif
 
406
#ifndef UINT16_C
356
407
#  define UINT16_C(value)   value##ui16
 
408
#endif
 
409
#ifndef UINT32_C
357
410
#  define UINT32_C(value)   value##ui32
 
411
#endif
 
412
#ifndef UINT64_C
358
413
#  define UINT64_C(value)   value##ui64
 
414
#endif
 
415
#ifndef INTMAX_C
359
416
#  define INTMAX_C(value)   value##i64
360
417
#  define UINTMAX_C(value)  value##ui64
 
418
#endif
361
419
 
362
420
# else
363
421
//  do it the old fashioned way:
364
422
 
365
423
//  8-bit types  ------------------------------------------------------------//
366
424
 
367
 
#  if UCHAR_MAX == 0xff
 
425
#  if (UCHAR_MAX == 0xff) && !defined(INT8_C)
368
426
#   define INT8_C(value) static_cast<boost::int8_t>(value)
369
427
#   define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
370
428
#  endif
371
429
 
372
430
//  16-bit types  -----------------------------------------------------------//
373
431
 
374
 
#  if USHRT_MAX == 0xffff
 
432
#  if (USHRT_MAX == 0xffff) && !defined(INT16_C)
375
433
#   define INT16_C(value) static_cast<boost::int16_t>(value)
376
434
#   define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
377
435
#  endif
378
436
 
379
437
//  32-bit types  -----------------------------------------------------------//
380
 
 
381
 
#  if UINT_MAX == 0xffffffff
 
438
#ifndef INT32_C
 
439
#  if (UINT_MAX == 0xffffffff)
382
440
#   define INT32_C(value) value
383
441
#   define UINT32_C(value) value##u
384
442
#  elif ULONG_MAX == 0xffffffff
385
443
#   define INT32_C(value) value##L
386
444
#   define UINT32_C(value) value##uL
387
445
#  endif
 
446
#endif
388
447
 
389
448
//  64-bit types + intmax_t and uintmax_t  ----------------------------------//
390
 
 
 
449
#ifndef INT64_C
391
450
#  if defined(BOOST_HAS_LONG_LONG) && \
392
 
    (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
 
451
    (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
393
452
 
394
453
#    if defined(__hpux)
395
 
     // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
396
 
#    elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) ||  \
397
 
        (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) ||  \
398
 
        (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U)
 
454
        // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
 
455
#       define INT64_C(value) value##LL
 
456
#       define UINT64_C(value) value##uLL
 
457
#    elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) ||  \
 
458
        (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) ||  \
 
459
        (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
 
460
        (defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL)
399
461
 
 
462
#       define INT64_C(value) value##LL
 
463
#       define UINT64_C(value) value##uLL
400
464
#    else
401
465
#       error defaults not correct; you must hand modify boost/cstdint.hpp
402
466
#    endif
403
 
#    define INT64_C(value) value##LL
404
 
#    define UINT64_C(value) value##uLL
405
467
#  elif ULONG_MAX != 0xffffffff
406
468
 
407
 
#    if ULONG_MAX == 18446744073709551615 // 2**64 - 1
 
469
#    if ULONG_MAX == 18446744073709551615U // 2**64 - 1
408
470
#       define INT64_C(value) value##L
409
471
#       define UINT64_C(value) value##uL
410
472
#    else
411
473
#       error defaults not correct; you must hand modify boost/cstdint.hpp
412
474
#    endif
 
475
#  elif defined(BOOST_HAS_LONG_LONG)
 
476
     // Usual macros not defined, work things out for ourselves:
 
477
#    if(~0uLL == 18446744073709551615ULL)
 
478
#       define INT64_C(value) value##LL
 
479
#       define UINT64_C(value) value##uLL
 
480
#    else
 
481
#       error defaults not correct; you must hand modify boost/cstdint.hpp
 
482
#    endif
 
483
#  else
 
484
#    error defaults not correct; you must hand modify boost/cstdint.hpp
413
485
#  endif
414
486
 
415
487
#  ifdef BOOST_NO_INT64_T
419
491
#   define INTMAX_C(value) INT64_C(value)
420
492
#   define UINTMAX_C(value) UINT64_C(value)
421
493
#  endif
422
 
 
 
494
#endif
423
495
# endif // Borland/Microsoft specific width suffixes
424
496
 
425
 
 
426
 
#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H)
427
 
//
428
 
// undef all the macros:
429
 
//
430
 
# undef INT8_C
431
 
# undef INT16_C
432
 
# undef INT32_C
433
 
# undef INT64_C
434
 
# undef UINT8_C
435
 
# undef UINT16_C
436
 
# undef UINT32_C
437
 
# undef UINT64_C
438
 
# undef INTMAX_C
439
 
# undef UINTMAX_C
440
 
 
441
 
#endif // __STDC_CONSTANT_MACROS_DEFINED etc.
 
497
#endif // INT#_C macros.
442
498
 
443
499
 
444
500