source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/cstdint.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

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