vrshoot

diff libs/assimp/pstdint.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/assimp/pstdint.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,729 @@
     1.4 +/*  A portable stdint.h
     1.5 + ****************************************************************************
     1.6 + *  BSD License:
     1.7 + ****************************************************************************
     1.8 + *
     1.9 + *  Copyright (c) 2005-2007 Paul Hsieh
    1.10 + *  All rights reserved.
    1.11 + *
    1.12 + *  Redistribution and use in source and binary forms, with or without
    1.13 + *  modification, are permitted provided that the following conditions
    1.14 + *  are met:
    1.15 + *
    1.16 + *  1. Redistributions of source code must retain the above copyright
    1.17 + *     notice, this list of conditions and the following disclaimer.
    1.18 + *  2. Redistributions in binary form must reproduce the above copyright
    1.19 + *     notice, this list of conditions and the following disclaimer in the
    1.20 + *     documentation and/or other materials provided with the distribution.
    1.21 + *  3. The name of the author may not be used to endorse or promote products
    1.22 + *     derived from this software without specific prior written permission.
    1.23 + *
    1.24 + *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    1.25 + *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    1.26 + *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.27 + *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    1.28 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    1.29 + *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.30 + *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.31 + *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.32 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    1.33 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.34 + *
    1.35 + ****************************************************************************
    1.36 + *
    1.37 + *  Version 0.1.10
    1.38 + *
    1.39 + *  The ANSI C standard committee, for the C99 standard, specified the
    1.40 + *  inclusion of a new standard include file called stdint.h.  This is
    1.41 + *  a very useful and long desired include file which contains several
    1.42 + *  very precise definitions for integer scalar types that is
    1.43 + *  critically important for making portable several classes of
    1.44 + *  applications including cryptography, hashing, variable length
    1.45 + *  integer libraries and so on.  But for most developers its likely
    1.46 + *  useful just for programming sanity.
    1.47 + *
    1.48 + *  The problem is that most compiler vendors have decided not to
    1.49 + *  implement the C99 standard, and the next C++ language standard
    1.50 + *  (which has a lot more mindshare these days) will be a long time in
    1.51 + *  coming and its unknown whether or not it will include stdint.h or
    1.52 + *  how much adoption it will have.  Either way, it will be a long time
    1.53 + *  before all compilers come with a stdint.h and it also does nothing
    1.54 + *  for the extremely large number of compilers available today which
    1.55 + *  do not include this file, or anything comparable to it.
    1.56 + *
    1.57 + *  So that's what this file is all about.  Its an attempt to build a
    1.58 + *  single universal include file that works on as many platforms as
    1.59 + *  possible to deliver what stdint.h is supposed to.  A few things
    1.60 + *  that should be noted about this file:
    1.61 + *
    1.62 + *    1) It is not guaranteed to be portable and/or present an identical
    1.63 + *       interface on all platforms.  The extreme variability of the
    1.64 + *       ANSI C standard makes this an impossibility right from the
    1.65 + *       very get go. Its really only meant to be useful for the vast
    1.66 + *       majority of platforms that possess the capability of
    1.67 + *       implementing usefully and precisely defined, standard sized
    1.68 + *       integer scalars.  Systems which are not intrinsically 2s
    1.69 + *       complement may produce invalid constants.
    1.70 + *
    1.71 + *    2) There is an unavoidable use of non-reserved symbols.
    1.72 + *
    1.73 + *    3) Other standard include files are invoked.
    1.74 + *
    1.75 + *    4) This file may come in conflict with future platforms that do
    1.76 + *       include stdint.h.  The hope is that one or the other can be
    1.77 + *       used with no real difference.
    1.78 + *
    1.79 + *    5) In the current verison, if your platform can't represent
    1.80 + *       int32_t, int16_t and int8_t, it just dumps out with a compiler
    1.81 + *       error.
    1.82 + *
    1.83 + *    6) 64 bit integers may or may not be defined.  Test for their
    1.84 + *       presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
    1.85 + *       Note that this is different from the C99 specification which
    1.86 + *       requires the existence of 64 bit support in the compiler.  If
    1.87 + *       this is not defined for your platform, yet it is capable of
    1.88 + *       dealing with 64 bits then it is because this file has not yet
    1.89 + *       been extended to cover all of your system's capabilities.
    1.90 + *
    1.91 + *    7) (u)intptr_t may or may not be defined.  Test for its presence
    1.92 + *       with the test: #ifdef PTRDIFF_MAX.  If this is not defined
    1.93 + *       for your platform, then it is because this file has not yet
    1.94 + *       been extended to cover all of your system's capabilities, not
    1.95 + *       because its optional.
    1.96 + *
    1.97 + *    8) The following might not been defined even if your platform is
    1.98 + *       capable of defining it:
    1.99 + *
   1.100 + *       WCHAR_MIN
   1.101 + *       WCHAR_MAX
   1.102 + *       (u)int64_t
   1.103 + *       PTRDIFF_MIN
   1.104 + *       PTRDIFF_MAX
   1.105 + *       (u)intptr_t
   1.106 + *
   1.107 + *    9) The following have not been defined:
   1.108 + *
   1.109 + *       WINT_MIN
   1.110 + *       WINT_MAX
   1.111 + *
   1.112 + *   10) The criteria for defining (u)int_least(*)_t isn't clear,
   1.113 + *       except for systems which don't have a type that precisely
   1.114 + *       defined 8, 16, or 32 bit types (which this include file does
   1.115 + *       not support anyways). Default definitions have been given.
   1.116 + *
   1.117 + *   11) The criteria for defining (u)int_fast(*)_t isn't something I
   1.118 + *       would trust to any particular compiler vendor or the ANSI C
   1.119 + *       committee.  It is well known that "compatible systems" are
   1.120 + *       commonly created that have very different performance
   1.121 + *       characteristics from the systems they are compatible with,
   1.122 + *       especially those whose vendors make both the compiler and the
   1.123 + *       system.  Default definitions have been given, but its strongly
   1.124 + *       recommended that users never use these definitions for any
   1.125 + *       reason (they do *NOT* deliver any serious guarantee of
   1.126 + *       improved performance -- not in this file, nor any vendor's
   1.127 + *       stdint.h).
   1.128 + *
   1.129 + *   12) The following macros:
   1.130 + *
   1.131 + *       PRINTF_INTMAX_MODIFIER
   1.132 + *       PRINTF_INT64_MODIFIER
   1.133 + *       PRINTF_INT32_MODIFIER
   1.134 + *       PRINTF_INT16_MODIFIER
   1.135 + *       PRINTF_LEAST64_MODIFIER
   1.136 + *       PRINTF_LEAST32_MODIFIER
   1.137 + *       PRINTF_LEAST16_MODIFIER
   1.138 + *       PRINTF_INTPTR_MODIFIER
   1.139 + *
   1.140 + *       are strings which have been defined as the modifiers required
   1.141 + *       for the "d", "u" and "x" printf formats to correctly output
   1.142 + *       (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
   1.143 + *       (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
   1.144 + *       PRINTF_INTPTR_MODIFIER is not defined for some systems which
   1.145 + *       provide their own stdint.h.  PRINTF_INT64_MODIFIER is not
   1.146 + *       defined if INT64_MAX is not defined.  These are an extension
   1.147 + *       beyond what C99 specifies must be in stdint.h.
   1.148 + *
   1.149 + *       In addition, the following macros are defined:
   1.150 + *
   1.151 + *       PRINTF_INTMAX_HEX_WIDTH
   1.152 + *       PRINTF_INT64_HEX_WIDTH
   1.153 + *       PRINTF_INT32_HEX_WIDTH
   1.154 + *       PRINTF_INT16_HEX_WIDTH
   1.155 + *       PRINTF_INT8_HEX_WIDTH
   1.156 + *       PRINTF_INTMAX_DEC_WIDTH
   1.157 + *       PRINTF_INT64_DEC_WIDTH
   1.158 + *       PRINTF_INT32_DEC_WIDTH
   1.159 + *       PRINTF_INT16_DEC_WIDTH
   1.160 + *       PRINTF_INT8_DEC_WIDTH
   1.161 + *
   1.162 + *       Which specifies the maximum number of characters required to
   1.163 + *       print the number of that type in either hexadecimal or decimal.
   1.164 + *       These are an extension beyond what C99 specifies must be in
   1.165 + *       stdint.h.
   1.166 + *
   1.167 + *  Compilers tested (all with 0 warnings at their highest respective
   1.168 + *  settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
   1.169 + *  bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
   1.170 + *  .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
   1.171 + *
   1.172 + *  This file should be considered a work in progress.  Suggestions for
   1.173 + *  improvements, especially those which increase coverage are strongly
   1.174 + *  encouraged.
   1.175 + *
   1.176 + *  Acknowledgements
   1.177 + *
   1.178 + *  The following people have made significant contributions to the
   1.179 + *  development and testing of this file:
   1.180 + *
   1.181 + *  Chris Howie
   1.182 + *  John Steele Scott
   1.183 + *  Dave Thorup
   1.184 + *
   1.185 + */
   1.186 +
   1.187 +#include <stddef.h>
   1.188 +#include <limits.h>
   1.189 +#include <signal.h>
   1.190 +
   1.191 +/*
   1.192 + *  For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
   1.193 + *  do nothing else.  On the Mac OS X version of gcc this is _STDINT_H_.
   1.194 + */
   1.195 +
   1.196 +#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)))) && !defined (_PSTDINT_H_INCLUDED) && !defined(_STDINT)
   1.197 +#include <stdint.h>
   1.198 +#define _PSTDINT_H_INCLUDED
   1.199 +# ifndef PRINTF_INT64_MODIFIER
   1.200 +#  define PRINTF_INT64_MODIFIER "ll"
   1.201 +# endif
   1.202 +# ifndef PRINTF_INT32_MODIFIER
   1.203 +#  define PRINTF_INT32_MODIFIER "l"
   1.204 +# endif
   1.205 +# ifndef PRINTF_INT16_MODIFIER
   1.206 +#  define PRINTF_INT16_MODIFIER "h"
   1.207 +# endif
   1.208 +# ifndef PRINTF_INTMAX_MODIFIER
   1.209 +#  define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   1.210 +# endif
   1.211 +# ifndef PRINTF_INT64_HEX_WIDTH
   1.212 +#  define PRINTF_INT64_HEX_WIDTH "16"
   1.213 +# endif
   1.214 +# ifndef PRINTF_INT32_HEX_WIDTH
   1.215 +#  define PRINTF_INT32_HEX_WIDTH "8"
   1.216 +# endif
   1.217 +# ifndef PRINTF_INT16_HEX_WIDTH
   1.218 +#  define PRINTF_INT16_HEX_WIDTH "4"
   1.219 +# endif
   1.220 +# ifndef PRINTF_INT8_HEX_WIDTH
   1.221 +#  define PRINTF_INT8_HEX_WIDTH "2"
   1.222 +# endif
   1.223 +# ifndef PRINTF_INT64_DEC_WIDTH
   1.224 +#  define PRINTF_INT64_DEC_WIDTH "20"
   1.225 +# endif
   1.226 +# ifndef PRINTF_INT32_DEC_WIDTH
   1.227 +#  define PRINTF_INT32_DEC_WIDTH "10"
   1.228 +# endif
   1.229 +# ifndef PRINTF_INT16_DEC_WIDTH
   1.230 +#  define PRINTF_INT16_DEC_WIDTH "5"
   1.231 +# endif
   1.232 +# ifndef PRINTF_INT8_DEC_WIDTH
   1.233 +#  define PRINTF_INT8_DEC_WIDTH "3"
   1.234 +# endif
   1.235 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.236 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
   1.237 +# endif
   1.238 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.239 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
   1.240 +# endif
   1.241 +
   1.242 +/*
   1.243 + *  Something really weird is going on with Open Watcom.  Just pull some of
   1.244 + *  these duplicated definitions from Open Watcom's stdint.h file for now.
   1.245 + */
   1.246 +
   1.247 +# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
   1.248 +#  if !defined (INT64_C)
   1.249 +#   define INT64_C(x)   (x + (INT64_MAX - INT64_MAX))
   1.250 +#  endif
   1.251 +#  if !defined (UINT64_C)
   1.252 +#   define UINT64_C(x)  (x + (UINT64_MAX - UINT64_MAX))
   1.253 +#  endif
   1.254 +#  if !defined (INT32_C)
   1.255 +#   define INT32_C(x)   (x + (INT32_MAX - INT32_MAX))
   1.256 +#  endif
   1.257 +#  if !defined (UINT32_C)
   1.258 +#   define UINT32_C(x)  (x + (UINT32_MAX - UINT32_MAX))
   1.259 +#  endif
   1.260 +#  if !defined (INT16_C)
   1.261 +#   define INT16_C(x)   (x)
   1.262 +#  endif
   1.263 +#  if !defined (UINT16_C)
   1.264 +#   define UINT16_C(x)  (x)
   1.265 +#  endif
   1.266 +#  if !defined (INT8_C)
   1.267 +#   define INT8_C(x)   (x)
   1.268 +#  endif
   1.269 +#  if !defined (UINT8_C)
   1.270 +#   define UINT8_C(x)  (x)
   1.271 +#  endif
   1.272 +#  if !defined (UINT64_MAX)
   1.273 +#   define UINT64_MAX  18446744073709551615ULL
   1.274 +#  endif
   1.275 +#  if !defined (INT64_MAX)
   1.276 +#   define INT64_MAX  9223372036854775807LL
   1.277 +#  endif
   1.278 +#  if !defined (UINT32_MAX)
   1.279 +#   define UINT32_MAX  4294967295UL
   1.280 +#  endif
   1.281 +#  if !defined (INT32_MAX)
   1.282 +#   define INT32_MAX  2147483647L
   1.283 +#  endif
   1.284 +#  if !defined (INTMAX_MAX)
   1.285 +#   define INTMAX_MAX INT64_MAX
   1.286 +#  endif
   1.287 +#  if !defined (INTMAX_MIN)
   1.288 +#   define INTMAX_MIN INT64_MIN
   1.289 +#  endif
   1.290 +# endif
   1.291 +#endif
   1.292 +
   1.293 +#ifndef _PSTDINT_H_INCLUDED
   1.294 +#define _PSTDINT_H_INCLUDED
   1.295 +
   1.296 +#ifndef SIZE_MAX
   1.297 +# define SIZE_MAX (~(size_t)0)
   1.298 +#endif
   1.299 +
   1.300 +/*
   1.301 + *  Deduce the type assignments from limits.h under the assumption that
   1.302 + *  integer sizes in bits are powers of 2, and follow the ANSI
   1.303 + *  definitions.
   1.304 + */
   1.305 +
   1.306 +#ifndef UINT8_MAX
   1.307 +# define UINT8_MAX 0xff
   1.308 +#endif
   1.309 +#ifndef uint8_t
   1.310 +# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
   1.311 +    typedef unsigned char uint8_t;
   1.312 +#   define UINT8_C(v) ((uint8_t) v)
   1.313 +# else
   1.314 +#   error "Platform not supported"
   1.315 +# endif
   1.316 +#endif
   1.317 +
   1.318 +#ifndef INT8_MAX
   1.319 +# define INT8_MAX 0x7f
   1.320 +#endif
   1.321 +#ifndef INT8_MIN
   1.322 +# define INT8_MIN INT8_C(0x80)
   1.323 +#endif
   1.324 +#ifndef int8_t
   1.325 +# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
   1.326 +    typedef signed char int8_t;
   1.327 +#   define INT8_C(v) ((int8_t) v)
   1.328 +# else
   1.329 +#   error "Platform not supported"
   1.330 +# endif
   1.331 +#endif
   1.332 +
   1.333 +#ifndef UINT16_MAX
   1.334 +# define UINT16_MAX 0xffff
   1.335 +#endif
   1.336 +#ifndef uint16_t
   1.337 +#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
   1.338 +  typedef unsigned int uint16_t;
   1.339 +# ifndef PRINTF_INT16_MODIFIER
   1.340 +#  define PRINTF_INT16_MODIFIER ""
   1.341 +# endif
   1.342 +# define UINT16_C(v) ((uint16_t) (v))
   1.343 +#elif (USHRT_MAX == UINT16_MAX)
   1.344 +  typedef unsigned short uint16_t;
   1.345 +# define UINT16_C(v) ((uint16_t) (v))
   1.346 +# ifndef PRINTF_INT16_MODIFIER
   1.347 +#  define PRINTF_INT16_MODIFIER "h"
   1.348 +# endif
   1.349 +#else
   1.350 +#error "Platform not supported"
   1.351 +#endif
   1.352 +#endif
   1.353 +
   1.354 +#ifndef INT16_MAX
   1.355 +# define INT16_MAX 0x7fff
   1.356 +#endif
   1.357 +#ifndef INT16_MIN
   1.358 +# define INT16_MIN INT16_C(0x8000)
   1.359 +#endif
   1.360 +#ifndef int16_t
   1.361 +#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
   1.362 +  typedef signed int int16_t;
   1.363 +# define INT16_C(v) ((int16_t) (v))
   1.364 +# ifndef PRINTF_INT16_MODIFIER
   1.365 +#  define PRINTF_INT16_MODIFIER ""
   1.366 +# endif
   1.367 +#elif (SHRT_MAX == INT16_MAX)
   1.368 +  typedef signed short int16_t;
   1.369 +# define INT16_C(v) ((int16_t) (v))
   1.370 +# ifndef PRINTF_INT16_MODIFIER
   1.371 +#  define PRINTF_INT16_MODIFIER "h"
   1.372 +# endif
   1.373 +#else
   1.374 +#error "Platform not supported"
   1.375 +#endif
   1.376 +#endif
   1.377 +
   1.378 +#ifndef UINT32_MAX
   1.379 +# define UINT32_MAX (0xffffffffUL)
   1.380 +#endif
   1.381 +#ifndef uint32_t
   1.382 +#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
   1.383 +  typedef unsigned long uint32_t;
   1.384 +# define UINT32_C(v) v ## UL
   1.385 +# ifndef PRINTF_INT32_MODIFIER
   1.386 +#  define PRINTF_INT32_MODIFIER "l"
   1.387 +# endif
   1.388 +#elif (UINT_MAX == UINT32_MAX)
   1.389 +  typedef unsigned int uint32_t;
   1.390 +# ifndef PRINTF_INT32_MODIFIER
   1.391 +#  define PRINTF_INT32_MODIFIER ""
   1.392 +# endif
   1.393 +# define UINT32_C(v) v ## U
   1.394 +#elif (USHRT_MAX == UINT32_MAX)
   1.395 +  typedef unsigned short uint32_t;
   1.396 +# define UINT32_C(v) ((unsigned short) (v))
   1.397 +# ifndef PRINTF_INT32_MODIFIER
   1.398 +#  define PRINTF_INT32_MODIFIER ""
   1.399 +# endif
   1.400 +#else
   1.401 +#error "Platform not supported"
   1.402 +#endif
   1.403 +#endif
   1.404 +
   1.405 +#ifndef INT32_MAX
   1.406 +# define INT32_MAX (0x7fffffffL)
   1.407 +#endif
   1.408 +#ifndef INT32_MIN
   1.409 +# define INT32_MIN INT32_C(0x80000000)
   1.410 +#endif
   1.411 +#ifndef int32_t
   1.412 +#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
   1.413 +  typedef signed long int32_t;
   1.414 +# define INT32_C(v) v ## L
   1.415 +# ifndef PRINTF_INT32_MODIFIER
   1.416 +#  define PRINTF_INT32_MODIFIER "l"
   1.417 +# endif
   1.418 +#elif (INT_MAX == INT32_MAX)
   1.419 +  typedef signed int int32_t;
   1.420 +# define INT32_C(v) v
   1.421 +# ifndef PRINTF_INT32_MODIFIER
   1.422 +#  define PRINTF_INT32_MODIFIER ""
   1.423 +# endif
   1.424 +#elif (SHRT_MAX == INT32_MAX)
   1.425 +  typedef signed short int32_t;
   1.426 +# define INT32_C(v) ((short) (v))
   1.427 +# ifndef PRINTF_INT32_MODIFIER
   1.428 +#  define PRINTF_INT32_MODIFIER ""
   1.429 +# endif
   1.430 +#else
   1.431 +#error "Platform not supported"
   1.432 +#endif
   1.433 +#endif
   1.434 +
   1.435 +/*
   1.436 + *  The macro stdint_int64_defined is temporarily used to record
   1.437 + *  whether or not 64 integer support is available.  It must be
   1.438 + *  defined for any 64 integer extensions for new platforms that are
   1.439 + *  added.
   1.440 + */
   1.441 +
   1.442 +#undef stdint_int64_defined
   1.443 +#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
   1.444 +# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
   1.445 +#  define stdint_int64_defined
   1.446 +   typedef long long int64_t;
   1.447 +   typedef unsigned long long uint64_t;
   1.448 +#  define UINT64_C(v) v ## ULL
   1.449 +#  define  INT64_C(v) v ## LL
   1.450 +#  ifndef PRINTF_INT64_MODIFIER
   1.451 +#   define PRINTF_INT64_MODIFIER "ll"
   1.452 +#  endif
   1.453 +# endif
   1.454 +#endif
   1.455 +
   1.456 +#if !defined (stdint_int64_defined)
   1.457 +# if defined(__GNUC__)
   1.458 +#  define stdint_int64_defined
   1.459 +   __extension__ typedef long long int64_t;
   1.460 +   __extension__ typedef unsigned long long uint64_t;
   1.461 +#  define UINT64_C(v) v ## ULL
   1.462 +#  define  INT64_C(v) v ## LL
   1.463 +#  ifndef PRINTF_INT64_MODIFIER
   1.464 +#   define PRINTF_INT64_MODIFIER "ll"
   1.465 +#  endif
   1.466 +# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
   1.467 +#  define stdint_int64_defined
   1.468 +   typedef long long int64_t;
   1.469 +   typedef unsigned long long uint64_t;
   1.470 +#  define UINT64_C(v) v ## ULL
   1.471 +#  define  INT64_C(v) v ## LL
   1.472 +#  ifndef PRINTF_INT64_MODIFIER
   1.473 +#   define PRINTF_INT64_MODIFIER "ll"
   1.474 +#  endif
   1.475 +# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
   1.476 +#  define stdint_int64_defined
   1.477 +   typedef __int64 int64_t;
   1.478 +   typedef unsigned __int64 uint64_t;
   1.479 +#  define UINT64_C(v) v ## UI64
   1.480 +#  define  INT64_C(v) v ## I64
   1.481 +#  ifndef PRINTF_INT64_MODIFIER
   1.482 +#   define PRINTF_INT64_MODIFIER "I64"
   1.483 +#  endif
   1.484 +# endif
   1.485 +#endif
   1.486 +
   1.487 +#if !defined (LONG_LONG_MAX) && defined (INT64_C)
   1.488 +# define LONG_LONG_MAX INT64_C (9223372036854775807)
   1.489 +#endif
   1.490 +#ifndef ULONG_LONG_MAX
   1.491 +# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
   1.492 +#endif
   1.493 +
   1.494 +#if !defined (INT64_MAX) && defined (INT64_C)
   1.495 +# define INT64_MAX INT64_C (9223372036854775807)
   1.496 +#endif
   1.497 +#if !defined (INT64_MIN) && defined (INT64_C)
   1.498 +# define INT64_MIN INT64_C (-9223372036854775808)
   1.499 +#endif
   1.500 +#if !defined (UINT64_MAX) && defined (INT64_C)
   1.501 +# define UINT64_MAX UINT64_C (18446744073709551615)
   1.502 +#endif
   1.503 +
   1.504 +/*
   1.505 + *  Width of hexadecimal for number field.
   1.506 + */
   1.507 +
   1.508 +#ifndef PRINTF_INT64_HEX_WIDTH
   1.509 +# define PRINTF_INT64_HEX_WIDTH "16"
   1.510 +#endif
   1.511 +#ifndef PRINTF_INT32_HEX_WIDTH
   1.512 +# define PRINTF_INT32_HEX_WIDTH "8"
   1.513 +#endif
   1.514 +#ifndef PRINTF_INT16_HEX_WIDTH
   1.515 +# define PRINTF_INT16_HEX_WIDTH "4"
   1.516 +#endif
   1.517 +#ifndef PRINTF_INT8_HEX_WIDTH
   1.518 +# define PRINTF_INT8_HEX_WIDTH "2"
   1.519 +#endif
   1.520 +
   1.521 +#ifndef PRINTF_INT64_DEC_WIDTH
   1.522 +# define PRINTF_INT64_DEC_WIDTH "20"
   1.523 +#endif
   1.524 +#ifndef PRINTF_INT32_DEC_WIDTH
   1.525 +# define PRINTF_INT32_DEC_WIDTH "10"
   1.526 +#endif
   1.527 +#ifndef PRINTF_INT16_DEC_WIDTH
   1.528 +# define PRINTF_INT16_DEC_WIDTH "5"
   1.529 +#endif
   1.530 +#ifndef PRINTF_INT8_DEC_WIDTH
   1.531 +# define PRINTF_INT8_DEC_WIDTH "3"
   1.532 +#endif
   1.533 +
   1.534 +/*
   1.535 + *  Ok, lets not worry about 128 bit integers for now.  Moore's law says
   1.536 + *  we don't need to worry about that until about 2040 at which point
   1.537 + *  we'll have bigger things to worry about.
   1.538 + */
   1.539 +
   1.540 +#ifdef stdint_int64_defined
   1.541 +  typedef int64_t intmax_t;
   1.542 +  typedef uint64_t uintmax_t;
   1.543 +# define  INTMAX_MAX   INT64_MAX
   1.544 +# define  INTMAX_MIN   INT64_MIN
   1.545 +# define UINTMAX_MAX  UINT64_MAX
   1.546 +# define UINTMAX_C(v) UINT64_C(v)
   1.547 +# define  INTMAX_C(v)  INT64_C(v)
   1.548 +# ifndef PRINTF_INTMAX_MODIFIER
   1.549 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   1.550 +# endif
   1.551 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.552 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
   1.553 +# endif
   1.554 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.555 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
   1.556 +# endif
   1.557 +#else
   1.558 +  typedef int32_t intmax_t;
   1.559 +  typedef uint32_t uintmax_t;
   1.560 +# define  INTMAX_MAX   INT32_MAX
   1.561 +# define UINTMAX_MAX  UINT32_MAX
   1.562 +# define UINTMAX_C(v) UINT32_C(v)
   1.563 +# define  INTMAX_C(v)  INT32_C(v)
   1.564 +# ifndef PRINTF_INTMAX_MODIFIER
   1.565 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
   1.566 +# endif
   1.567 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.568 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
   1.569 +# endif
   1.570 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.571 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
   1.572 +# endif
   1.573 +#endif
   1.574 +
   1.575 +/*
   1.576 + *  Because this file currently only supports platforms which have
   1.577 + *  precise powers of 2 as bit sizes for the default integers, the
   1.578 + *  least definitions are all trivial.  Its possible that a future
   1.579 + *  version of this file could have different definitions.
   1.580 + */
   1.581 +
   1.582 +#ifndef stdint_least_defined
   1.583 +  typedef   int8_t   int_least8_t;
   1.584 +  typedef  uint8_t  uint_least8_t;
   1.585 +  typedef  int16_t  int_least16_t;
   1.586 +  typedef uint16_t uint_least16_t;
   1.587 +  typedef  int32_t  int_least32_t;
   1.588 +  typedef uint32_t uint_least32_t;
   1.589 +# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
   1.590 +# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
   1.591 +# define  UINT_LEAST8_MAX  UINT8_MAX
   1.592 +# define   INT_LEAST8_MAX   INT8_MAX
   1.593 +# define UINT_LEAST16_MAX UINT16_MAX
   1.594 +# define  INT_LEAST16_MAX  INT16_MAX
   1.595 +# define UINT_LEAST32_MAX UINT32_MAX
   1.596 +# define  INT_LEAST32_MAX  INT32_MAX
   1.597 +# define   INT_LEAST8_MIN   INT8_MIN
   1.598 +# define  INT_LEAST16_MIN  INT16_MIN
   1.599 +# define  INT_LEAST32_MIN  INT32_MIN
   1.600 +# ifdef stdint_int64_defined
   1.601 +    typedef  int64_t  int_least64_t;
   1.602 +    typedef uint64_t uint_least64_t;
   1.603 +#   define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
   1.604 +#   define UINT_LEAST64_MAX UINT64_MAX
   1.605 +#   define  INT_LEAST64_MAX  INT64_MAX
   1.606 +#   define  INT_LEAST64_MIN  INT64_MIN
   1.607 +# endif
   1.608 +#endif
   1.609 +#undef stdint_least_defined
   1.610 +
   1.611 +/*
   1.612 + *  The ANSI C committee pretending to know or specify anything about
   1.613 + *  performance is the epitome of misguided arrogance.  The mandate of
   1.614 + *  this file is to *ONLY* ever support that absolute minimum
   1.615 + *  definition of the fast integer types, for compatibility purposes.
   1.616 + *  No extensions, and no attempt to suggest what may or may not be a
   1.617 + *  faster integer type will ever be made in this file.  Developers are
   1.618 + *  warned to stay away from these types when using this or any other
   1.619 + *  stdint.h.
   1.620 + */
   1.621 +
   1.622 +typedef   int_least8_t   int_fast8_t;
   1.623 +typedef  uint_least8_t  uint_fast8_t;
   1.624 +typedef  int_least16_t  int_fast16_t;
   1.625 +typedef uint_least16_t uint_fast16_t;
   1.626 +typedef  int_least32_t  int_fast32_t;
   1.627 +typedef uint_least32_t uint_fast32_t;
   1.628 +#define  UINT_FAST8_MAX  UINT_LEAST8_MAX
   1.629 +#define   INT_FAST8_MAX   INT_LEAST8_MAX
   1.630 +#define UINT_FAST16_MAX UINT_LEAST16_MAX
   1.631 +#define  INT_FAST16_MAX  INT_LEAST16_MAX
   1.632 +#define UINT_FAST32_MAX UINT_LEAST32_MAX
   1.633 +#define  INT_FAST32_MAX  INT_LEAST32_MAX
   1.634 +#define   INT_FAST8_MIN   INT_LEAST8_MIN
   1.635 +#define  INT_FAST16_MIN  INT_LEAST16_MIN
   1.636 +#define  INT_FAST32_MIN  INT_LEAST32_MIN
   1.637 +#ifdef stdint_int64_defined
   1.638 +  typedef  int_least64_t  int_fast64_t;
   1.639 +  typedef uint_least64_t uint_fast64_t;
   1.640 +# define UINT_FAST64_MAX UINT_LEAST64_MAX
   1.641 +# define  INT_FAST64_MAX  INT_LEAST64_MAX
   1.642 +# define  INT_FAST64_MIN  INT_LEAST64_MIN
   1.643 +#endif
   1.644 +
   1.645 +#undef stdint_int64_defined
   1.646 +
   1.647 +/*
   1.648 + *  Whatever piecemeal, per compiler thing we can do about the wchar_t
   1.649 + *  type limits.
   1.650 + */
   1.651 +
   1.652 +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
   1.653 +# include <wchar.h>
   1.654 +# ifndef WCHAR_MIN
   1.655 +#  define WCHAR_MIN 0
   1.656 +# endif
   1.657 +# ifndef WCHAR_MAX
   1.658 +#  define WCHAR_MAX ((wchar_t)-1)
   1.659 +# endif
   1.660 +#endif
   1.661 +
   1.662 +/*
   1.663 + *  Whatever piecemeal, per compiler/platform thing we can do about the
   1.664 + *  (u)intptr_t types and limits.
   1.665 + */
   1.666 +
   1.667 +#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
   1.668 +# define STDINT_H_UINTPTR_T_DEFINED
   1.669 +#endif
   1.670 +
   1.671 +#ifndef STDINT_H_UINTPTR_T_DEFINED
   1.672 +# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
   1.673 +#  define stdint_intptr_bits 64
   1.674 +# elif defined (__WATCOMC__) || defined (__TURBOC__)
   1.675 +#  if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
   1.676 +#    define stdint_intptr_bits 16
   1.677 +#  else
   1.678 +#    define stdint_intptr_bits 32
   1.679 +#  endif
   1.680 +# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
   1.681 +#  define stdint_intptr_bits 32
   1.682 +# elif defined (__INTEL_COMPILER)
   1.683 +/* TODO -- what will Intel do about x86-64? */
   1.684 +# endif
   1.685 +
   1.686 +# ifdef stdint_intptr_bits
   1.687 +#  define stdint_intptr_glue3_i(a,b,c)  a##b##c
   1.688 +#  define stdint_intptr_glue3(a,b,c)    stdint_intptr_glue3_i(a,b,c)
   1.689 +#  ifndef PRINTF_INTPTR_MODIFIER
   1.690 +#    define PRINTF_INTPTR_MODIFIER      stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
   1.691 +#  endif
   1.692 +#  ifndef PTRDIFF_MAX
   1.693 +#    define PTRDIFF_MAX                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   1.694 +#  endif
   1.695 +#  ifndef PTRDIFF_MIN
   1.696 +#    define PTRDIFF_MIN                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   1.697 +#  endif
   1.698 +#  ifndef UINTPTR_MAX
   1.699 +#    define UINTPTR_MAX                 stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
   1.700 +#  endif
   1.701 +#  ifndef INTPTR_MAX
   1.702 +#    define INTPTR_MAX                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   1.703 +#  endif
   1.704 +#  ifndef INTPTR_MIN
   1.705 +#    define INTPTR_MIN                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   1.706 +#  endif
   1.707 +#  ifndef INTPTR_C
   1.708 +#    define INTPTR_C(x)                 stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
   1.709 +#  endif
   1.710 +#  ifndef UINTPTR_C
   1.711 +#    define UINTPTR_C(x)                stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
   1.712 +#  endif
   1.713 +  typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
   1.714 +  typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t)  intptr_t;
   1.715 +# else
   1.716 +/* TODO -- This following is likely wrong for some platforms, and does
   1.717 +   nothing for the definition of uintptr_t. */
   1.718 +  typedef ptrdiff_t intptr_t;
   1.719 +# endif
   1.720 +# define STDINT_H_UINTPTR_T_DEFINED
   1.721 +#endif
   1.722 +
   1.723 +/*
   1.724 + *  Assumes sig_atomic_t is signed and we have a 2s complement machine.
   1.725 + */
   1.726 +
   1.727 +#ifndef SIG_ATOMIC_MAX
   1.728 +# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
   1.729 +#endif
   1.730 +
   1.731 +#endif
   1.732 +