miniassimp

diff include/miniassimp/Compiler/pstdint.h @ 0:879c81d94345

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Jan 2019 18:19:26 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/miniassimp/Compiler/pstdint.h	Mon Jan 28 18:19:26 2019 +0200
     1.3 @@ -0,0 +1,912 @@
     1.4 +/*  A portable stdint.h
     1.5 + ****************************************************************************
     1.6 + *  BSD License:
     1.7 + ****************************************************************************
     1.8 + *
     1.9 + *  Copyright (c) 2005-2016 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.15.4
    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 some compiler vendors chose to ignore the C99
    1.49 + *  standard and some older compilers have no opportunity to be updated.
    1.50 + *  Because of this situation, simply including stdint.h in your code
    1.51 + *  makes it unportable.
    1.52 + *
    1.53 + *  So that's what this file is all about.  Its an attempt to build a
    1.54 + *  single universal include file that works on as many platforms as
    1.55 + *  possible to deliver what stdint.h is supposed to.  Even compilers
    1.56 + *  that already come with stdint.h can use this file instead without
    1.57 + *  any loss of functionality.  A few things that should be noted about
    1.58 + *  this file:
    1.59 + *
    1.60 + *    1) It is not guaranteed to be portable and/or present an identical
    1.61 + *       interface on all platforms.  The extreme variability of the
    1.62 + *       ANSI C standard makes this an impossibility right from the
    1.63 + *       very get go. Its really only meant to be useful for the vast
    1.64 + *       majority of platforms that possess the capability of
    1.65 + *       implementing usefully and precisely defined, standard sized
    1.66 + *       integer scalars.  Systems which are not intrinsically 2s
    1.67 + *       complement may produce invalid constants.
    1.68 + *
    1.69 + *    2) There is an unavoidable use of non-reserved symbols.
    1.70 + *
    1.71 + *    3) Other standard include files are invoked.
    1.72 + *
    1.73 + *    4) This file may come in conflict with future platforms that do
    1.74 + *       include stdint.h.  The hope is that one or the other can be
    1.75 + *       used with no real difference.
    1.76 + *
    1.77 + *    5) In the current version, if your platform can't represent
    1.78 + *       int32_t, int16_t and int8_t, it just dumps out with a compiler
    1.79 + *       error.
    1.80 + *
    1.81 + *    6) 64 bit integers may or may not be defined.  Test for their
    1.82 + *       presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
    1.83 + *       Note that this is different from the C99 specification which
    1.84 + *       requires the existence of 64 bit support in the compiler.  If
    1.85 + *       this is not defined for your platform, yet it is capable of
    1.86 + *       dealing with 64 bits then it is because this file has not yet
    1.87 + *       been extended to cover all of your system's capabilities.
    1.88 + *
    1.89 + *    7) (u)intptr_t may or may not be defined.  Test for its presence
    1.90 + *       with the test: #ifdef PTRDIFF_MAX.  If this is not defined
    1.91 + *       for your platform, then it is because this file has not yet
    1.92 + *       been extended to cover all of your system's capabilities, not
    1.93 + *       because its optional.
    1.94 + *
    1.95 + *    8) The following might not been defined even if your platform is
    1.96 + *       capable of defining it:
    1.97 + *
    1.98 + *       WCHAR_MIN
    1.99 + *       WCHAR_MAX
   1.100 + *       (u)int64_t
   1.101 + *       PTRDIFF_MIN
   1.102 + *       PTRDIFF_MAX
   1.103 + *       (u)intptr_t
   1.104 + *
   1.105 + *    9) The following have not been defined:
   1.106 + *
   1.107 + *       WINT_MIN
   1.108 + *       WINT_MAX
   1.109 + *
   1.110 + *   10) The criteria for defining (u)int_least(*)_t isn't clear,
   1.111 + *       except for systems which don't have a type that precisely
   1.112 + *       defined 8, 16, or 32 bit types (which this include file does
   1.113 + *       not support anyways). Default definitions have been given.
   1.114 + *
   1.115 + *   11) The criteria for defining (u)int_fast(*)_t isn't something I
   1.116 + *       would trust to any particular compiler vendor or the ANSI C
   1.117 + *       committee.  It is well known that "compatible systems" are
   1.118 + *       commonly created that have very different performance
   1.119 + *       characteristics from the systems they are compatible with,
   1.120 + *       especially those whose vendors make both the compiler and the
   1.121 + *       system.  Default definitions have been given, but its strongly
   1.122 + *       recommended that users never use these definitions for any
   1.123 + *       reason (they do *NOT* deliver any serious guarantee of
   1.124 + *       improved performance -- not in this file, nor any vendor's
   1.125 + *       stdint.h).
   1.126 + *
   1.127 + *   12) The following macros:
   1.128 + *
   1.129 + *       PRINTF_INTMAX_MODIFIER
   1.130 + *       PRINTF_INT64_MODIFIER
   1.131 + *       PRINTF_INT32_MODIFIER
   1.132 + *       PRINTF_INT16_MODIFIER
   1.133 + *       PRINTF_LEAST64_MODIFIER
   1.134 + *       PRINTF_LEAST32_MODIFIER
   1.135 + *       PRINTF_LEAST16_MODIFIER
   1.136 + *       PRINTF_INTPTR_MODIFIER
   1.137 + *
   1.138 + *       are strings which have been defined as the modifiers required
   1.139 + *       for the "d", "u" and "x" printf formats to correctly output
   1.140 + *       (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
   1.141 + *       (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
   1.142 + *       PRINTF_INTPTR_MODIFIER is not defined for some systems which
   1.143 + *       provide their own stdint.h.  PRINTF_INT64_MODIFIER is not
   1.144 + *       defined if INT64_MAX is not defined.  These are an extension
   1.145 + *       beyond what C99 specifies must be in stdint.h.
   1.146 + *
   1.147 + *       In addition, the following macros are defined:
   1.148 + *
   1.149 + *       PRINTF_INTMAX_HEX_WIDTH
   1.150 + *       PRINTF_INT64_HEX_WIDTH
   1.151 + *       PRINTF_INT32_HEX_WIDTH
   1.152 + *       PRINTF_INT16_HEX_WIDTH
   1.153 + *       PRINTF_INT8_HEX_WIDTH
   1.154 + *       PRINTF_INTMAX_DEC_WIDTH
   1.155 + *       PRINTF_INT64_DEC_WIDTH
   1.156 + *       PRINTF_INT32_DEC_WIDTH
   1.157 + *       PRINTF_INT16_DEC_WIDTH
   1.158 + *       PRINTF_UINT8_DEC_WIDTH
   1.159 + *       PRINTF_UINTMAX_DEC_WIDTH
   1.160 + *       PRINTF_UINT64_DEC_WIDTH
   1.161 + *       PRINTF_UINT32_DEC_WIDTH
   1.162 + *       PRINTF_UINT16_DEC_WIDTH
   1.163 + *       PRINTF_UINT8_DEC_WIDTH
   1.164 + *
   1.165 + *       Which specifies the maximum number of characters required to
   1.166 + *       print the number of that type in either hexadecimal or decimal.
   1.167 + *       These are an extension beyond what C99 specifies must be in
   1.168 + *       stdint.h.
   1.169 + *
   1.170 + *  Compilers tested (all with 0 warnings at their highest respective
   1.171 + *  settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
   1.172 + *  bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
   1.173 + *  .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
   1.174 + *
   1.175 + *  This file should be considered a work in progress.  Suggestions for
   1.176 + *  improvements, especially those which increase coverage are strongly
   1.177 + *  encouraged.
   1.178 + *
   1.179 + *  Acknowledgements
   1.180 + *
   1.181 + *  The following people have made significant contributions to the
   1.182 + *  development and testing of this file:
   1.183 + *
   1.184 + *  Chris Howie
   1.185 + *  John Steele Scott
   1.186 + *  Dave Thorup
   1.187 + *  John Dill
   1.188 + *  Florian Wobbe
   1.189 + *  Christopher Sean Morrison
   1.190 + *  Mikkel Fahnoe Jorgensen
   1.191 + *
   1.192 + */
   1.193 +
   1.194 +#include <stddef.h>
   1.195 +#include <limits.h>
   1.196 +#include <signal.h>
   1.197 +
   1.198 +/*
   1.199 + *  For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
   1.200 + *  do nothing else.  On the Mac OS X version of gcc this is _STDINT_H_.
   1.201 + */
   1.202 +
   1.203 +#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
   1.204 +#include <stdint.h>
   1.205 +#define _PSTDINT_H_INCLUDED
   1.206 +# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))
   1.207 +#  ifndef PRINTF_INT64_MODIFIER
   1.208 +#   define PRINTF_INT64_MODIFIER "l"
   1.209 +#  endif
   1.210 +#  ifndef PRINTF_INT32_MODIFIER
   1.211 +#   define PRINTF_INT32_MODIFIER ""
   1.212 +#  endif
   1.213 +# else
   1.214 +#  ifndef PRINTF_INT64_MODIFIER
   1.215 +#   define PRINTF_INT64_MODIFIER "ll"
   1.216 +#  endif
   1.217 +#  ifndef PRINTF_INT32_MODIFIER
   1.218 +#   if (UINT_MAX == UINT32_MAX)
   1.219 +#    define PRINTF_INT32_MODIFIER ""
   1.220 +#   else
   1.221 +#    define PRINTF_INT32_MODIFIER "l"
   1.222 +#   endif
   1.223 +#  endif
   1.224 +# endif
   1.225 +# ifndef PRINTF_INT16_MODIFIER
   1.226 +#  define PRINTF_INT16_MODIFIER "h"
   1.227 +# endif
   1.228 +# ifndef PRINTF_INTMAX_MODIFIER
   1.229 +#  define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   1.230 +# endif
   1.231 +# ifndef PRINTF_INT64_HEX_WIDTH
   1.232 +#  define PRINTF_INT64_HEX_WIDTH "16"
   1.233 +# endif
   1.234 +# ifndef PRINTF_UINT64_HEX_WIDTH
   1.235 +#  define PRINTF_UINT64_HEX_WIDTH "16"
   1.236 +# endif
   1.237 +# ifndef PRINTF_INT32_HEX_WIDTH
   1.238 +#  define PRINTF_INT32_HEX_WIDTH "8"
   1.239 +# endif
   1.240 +# ifndef PRINTF_UINT32_HEX_WIDTH
   1.241 +#  define PRINTF_UINT32_HEX_WIDTH "8"
   1.242 +# endif
   1.243 +# ifndef PRINTF_INT16_HEX_WIDTH
   1.244 +#  define PRINTF_INT16_HEX_WIDTH "4"
   1.245 +# endif
   1.246 +# ifndef PRINTF_UINT16_HEX_WIDTH
   1.247 +#  define PRINTF_UINT16_HEX_WIDTH "4"
   1.248 +# endif
   1.249 +# ifndef PRINTF_INT8_HEX_WIDTH
   1.250 +#  define PRINTF_INT8_HEX_WIDTH "2"
   1.251 +# endif
   1.252 +# ifndef PRINTF_UINT8_HEX_WIDTH
   1.253 +#  define PRINTF_UINT8_HEX_WIDTH "2"
   1.254 +# endif
   1.255 +# ifndef PRINTF_INT64_DEC_WIDTH
   1.256 +#  define PRINTF_INT64_DEC_WIDTH "19"
   1.257 +# endif
   1.258 +# ifndef PRINTF_UINT64_DEC_WIDTH
   1.259 +#  define PRINTF_UINT64_DEC_WIDTH "20"
   1.260 +# endif
   1.261 +# ifndef PRINTF_INT32_DEC_WIDTH
   1.262 +#  define PRINTF_INT32_DEC_WIDTH "10"
   1.263 +# endif
   1.264 +# ifndef PRINTF_UINT32_DEC_WIDTH
   1.265 +#  define PRINTF_UINT32_DEC_WIDTH "10"
   1.266 +# endif
   1.267 +# ifndef PRINTF_INT16_DEC_WIDTH
   1.268 +#  define PRINTF_INT16_DEC_WIDTH "5"
   1.269 +# endif
   1.270 +# ifndef PRINTF_UINT16_DEC_WIDTH
   1.271 +#  define PRINTF_UINT16_DEC_WIDTH "5"
   1.272 +# endif
   1.273 +# ifndef PRINTF_INT8_DEC_WIDTH
   1.274 +#  define PRINTF_INT8_DEC_WIDTH "3"
   1.275 +# endif
   1.276 +# ifndef PRINTF_UINT8_DEC_WIDTH
   1.277 +#  define PRINTF_UINT8_DEC_WIDTH "3"
   1.278 +# endif
   1.279 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.280 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
   1.281 +# endif
   1.282 +# ifndef PRINTF_UINTMAX_HEX_WIDTH
   1.283 +#  define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
   1.284 +# endif
   1.285 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.286 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
   1.287 +# endif
   1.288 +# ifndef PRINTF_UINTMAX_DEC_WIDTH
   1.289 +#  define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
   1.290 +# endif
   1.291 +
   1.292 +/*
   1.293 + *  Something really weird is going on with Open Watcom.  Just pull some of
   1.294 + *  these duplicated definitions from Open Watcom's stdint.h file for now.
   1.295 + */
   1.296 +
   1.297 +# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
   1.298 +#  if !defined (INT64_C)
   1.299 +#   define INT64_C(x)   (x + (INT64_MAX - INT64_MAX))
   1.300 +#  endif
   1.301 +#  if !defined (UINT64_C)
   1.302 +#   define UINT64_C(x)  (x + (UINT64_MAX - UINT64_MAX))
   1.303 +#  endif
   1.304 +#  if !defined (INT32_C)
   1.305 +#   define INT32_C(x)   (x + (INT32_MAX - INT32_MAX))
   1.306 +#  endif
   1.307 +#  if !defined (UINT32_C)
   1.308 +#   define UINT32_C(x)  (x + (UINT32_MAX - UINT32_MAX))
   1.309 +#  endif
   1.310 +#  if !defined (INT16_C)
   1.311 +#   define INT16_C(x)   (x)
   1.312 +#  endif
   1.313 +#  if !defined (UINT16_C)
   1.314 +#   define UINT16_C(x)  (x)
   1.315 +#  endif
   1.316 +#  if !defined (INT8_C)
   1.317 +#   define INT8_C(x)   (x)
   1.318 +#  endif
   1.319 +#  if !defined (UINT8_C)
   1.320 +#   define UINT8_C(x)  (x)
   1.321 +#  endif
   1.322 +#  if !defined (UINT64_MAX)
   1.323 +#   define UINT64_MAX  18446744073709551615ULL
   1.324 +#  endif
   1.325 +#  if !defined (INT64_MAX)
   1.326 +#   define INT64_MAX  9223372036854775807LL
   1.327 +#  endif
   1.328 +#  if !defined (UINT32_MAX)
   1.329 +#   define UINT32_MAX  4294967295UL
   1.330 +#  endif
   1.331 +#  if !defined (INT32_MAX)
   1.332 +#   define INT32_MAX  2147483647L
   1.333 +#  endif
   1.334 +#  if !defined (INTMAX_MAX)
   1.335 +#   define INTMAX_MAX INT64_MAX
   1.336 +#  endif
   1.337 +#  if !defined (INTMAX_MIN)
   1.338 +#   define INTMAX_MIN INT64_MIN
   1.339 +#  endif
   1.340 +# endif
   1.341 +#endif
   1.342 +
   1.343 +/*
   1.344 + *  I have no idea what is the truly correct thing to do on older Solaris.
   1.345 + *  From some online discussions, this seems to be what is being
   1.346 + *  recommended.  For people who actually are developing on older Solaris,
   1.347 + *  what I would like to know is, does this define all of the relevant
   1.348 + *  macros of a complete stdint.h?  Remember, in pstdint.h 64 bit is
   1.349 + *  considered optional.
   1.350 + */
   1.351 +
   1.352 +#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)
   1.353 +#include <sys/inttypes.h>
   1.354 +#define _PSTDINT_H_INCLUDED
   1.355 +#endif
   1.356 +
   1.357 +#ifndef _PSTDINT_H_INCLUDED
   1.358 +#define _PSTDINT_H_INCLUDED
   1.359 +
   1.360 +#ifndef SIZE_MAX
   1.361 +# define SIZE_MAX (~(size_t)0)
   1.362 +#endif
   1.363 +
   1.364 +/*
   1.365 + *  Deduce the type assignments from limits.h under the assumption that
   1.366 + *  integer sizes in bits are powers of 2, and follow the ANSI
   1.367 + *  definitions.
   1.368 + */
   1.369 +
   1.370 +#ifndef UINT8_MAX
   1.371 +# define UINT8_MAX 0xff
   1.372 +#endif
   1.373 +#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)
   1.374 +# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
   1.375 +    typedef unsigned char uint8_t;
   1.376 +#   define UINT8_C(v) ((uint8_t) v)
   1.377 +# else
   1.378 +#   error "Platform not supported"
   1.379 +# endif
   1.380 +#endif
   1.381 +
   1.382 +#ifndef INT8_MAX
   1.383 +# define INT8_MAX 0x7f
   1.384 +#endif
   1.385 +#ifndef INT8_MIN
   1.386 +# define INT8_MIN INT8_C(0x80)
   1.387 +#endif
   1.388 +#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)
   1.389 +# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
   1.390 +    typedef signed char int8_t;
   1.391 +#   define INT8_C(v) ((int8_t) v)
   1.392 +# else
   1.393 +#   error "Platform not supported"
   1.394 +# endif
   1.395 +#endif
   1.396 +
   1.397 +#ifndef UINT16_MAX
   1.398 +# define UINT16_MAX 0xffff
   1.399 +#endif
   1.400 +#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)
   1.401 +#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
   1.402 +  typedef unsigned int uint16_t;
   1.403 +# ifndef PRINTF_INT16_MODIFIER
   1.404 +#  define PRINTF_INT16_MODIFIER ""
   1.405 +# endif
   1.406 +# define UINT16_C(v) ((uint16_t) (v))
   1.407 +#elif (USHRT_MAX == UINT16_MAX)
   1.408 +  typedef unsigned short uint16_t;
   1.409 +# define UINT16_C(v) ((uint16_t) (v))
   1.410 +# ifndef PRINTF_INT16_MODIFIER
   1.411 +#  define PRINTF_INT16_MODIFIER "h"
   1.412 +# endif
   1.413 +#else
   1.414 +#error "Platform not supported"
   1.415 +#endif
   1.416 +#endif
   1.417 +
   1.418 +#ifndef INT16_MAX
   1.419 +# define INT16_MAX 0x7fff
   1.420 +#endif
   1.421 +#ifndef INT16_MIN
   1.422 +# define INT16_MIN INT16_C(0x8000)
   1.423 +#endif
   1.424 +#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)
   1.425 +#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
   1.426 +  typedef signed int int16_t;
   1.427 +# define INT16_C(v) ((int16_t) (v))
   1.428 +# ifndef PRINTF_INT16_MODIFIER
   1.429 +#  define PRINTF_INT16_MODIFIER ""
   1.430 +# endif
   1.431 +#elif (SHRT_MAX == INT16_MAX)
   1.432 +  typedef signed short int16_t;
   1.433 +# define INT16_C(v) ((int16_t) (v))
   1.434 +# ifndef PRINTF_INT16_MODIFIER
   1.435 +#  define PRINTF_INT16_MODIFIER "h"
   1.436 +# endif
   1.437 +#else
   1.438 +#error "Platform not supported"
   1.439 +#endif
   1.440 +#endif
   1.441 +
   1.442 +#ifndef UINT32_MAX
   1.443 +# define UINT32_MAX (0xffffffffUL)
   1.444 +#endif
   1.445 +#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)
   1.446 +#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
   1.447 +  typedef unsigned long uint32_t;
   1.448 +# define UINT32_C(v) v ## UL
   1.449 +# ifndef PRINTF_INT32_MODIFIER
   1.450 +#  define PRINTF_INT32_MODIFIER "l"
   1.451 +# endif
   1.452 +#elif (UINT_MAX == UINT32_MAX)
   1.453 +  typedef unsigned int uint32_t;
   1.454 +# ifndef PRINTF_INT32_MODIFIER
   1.455 +#  define PRINTF_INT32_MODIFIER ""
   1.456 +# endif
   1.457 +# define UINT32_C(v) v ## U
   1.458 +#elif (USHRT_MAX == UINT32_MAX)
   1.459 +  typedef unsigned short uint32_t;
   1.460 +# define UINT32_C(v) ((unsigned short) (v))
   1.461 +# ifndef PRINTF_INT32_MODIFIER
   1.462 +#  define PRINTF_INT32_MODIFIER ""
   1.463 +# endif
   1.464 +#else
   1.465 +#error "Platform not supported"
   1.466 +#endif
   1.467 +#endif
   1.468 +
   1.469 +#ifndef INT32_MAX
   1.470 +# define INT32_MAX (0x7fffffffL)
   1.471 +#endif
   1.472 +#ifndef INT32_MIN
   1.473 +# define INT32_MIN INT32_C(0x80000000)
   1.474 +#endif
   1.475 +#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)
   1.476 +#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
   1.477 +  typedef signed long int32_t;
   1.478 +# define INT32_C(v) v ## L
   1.479 +# ifndef PRINTF_INT32_MODIFIER
   1.480 +#  define PRINTF_INT32_MODIFIER "l"
   1.481 +# endif
   1.482 +#elif (INT_MAX == INT32_MAX)
   1.483 +  typedef signed int int32_t;
   1.484 +# define INT32_C(v) v
   1.485 +# ifndef PRINTF_INT32_MODIFIER
   1.486 +#  define PRINTF_INT32_MODIFIER ""
   1.487 +# endif
   1.488 +#elif (SHRT_MAX == INT32_MAX)
   1.489 +  typedef signed short int32_t;
   1.490 +# define INT32_C(v) ((short) (v))
   1.491 +# ifndef PRINTF_INT32_MODIFIER
   1.492 +#  define PRINTF_INT32_MODIFIER ""
   1.493 +# endif
   1.494 +#else
   1.495 +#error "Platform not supported"
   1.496 +#endif
   1.497 +#endif
   1.498 +
   1.499 +/*
   1.500 + *  The macro stdint_int64_defined is temporarily used to record
   1.501 + *  whether or not 64 integer support is available.  It must be
   1.502 + *  defined for any 64 integer extensions for new platforms that are
   1.503 + *  added.
   1.504 + */
   1.505 +
   1.506 +#undef stdint_int64_defined
   1.507 +#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
   1.508 +# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
   1.509 +#  define stdint_int64_defined
   1.510 +   typedef long long int64_t;
   1.511 +   typedef unsigned long long uint64_t;
   1.512 +#  define UINT64_C(v) v ## ULL
   1.513 +#  define  INT64_C(v) v ## LL
   1.514 +#  ifndef PRINTF_INT64_MODIFIER
   1.515 +#   define PRINTF_INT64_MODIFIER "ll"
   1.516 +#  endif
   1.517 +# endif
   1.518 +#endif
   1.519 +
   1.520 +#if !defined (stdint_int64_defined)
   1.521 +# if defined(__GNUC__) && !defined(vxWorks)
   1.522 +#  define stdint_int64_defined
   1.523 +   __extension__ typedef long long int64_t;
   1.524 +   __extension__ typedef unsigned long long uint64_t;
   1.525 +#  define UINT64_C(v) v ## ULL
   1.526 +#  define  INT64_C(v) v ## LL
   1.527 +#  ifndef PRINTF_INT64_MODIFIER
   1.528 +#   define PRINTF_INT64_MODIFIER "ll"
   1.529 +#  endif
   1.530 +# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
   1.531 +#  define stdint_int64_defined
   1.532 +   typedef long long int64_t;
   1.533 +   typedef unsigned long long uint64_t;
   1.534 +#  define UINT64_C(v) v ## ULL
   1.535 +#  define  INT64_C(v) v ## LL
   1.536 +#  ifndef PRINTF_INT64_MODIFIER
   1.537 +#   define PRINTF_INT64_MODIFIER "ll"
   1.538 +#  endif
   1.539 +# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
   1.540 +#  define stdint_int64_defined
   1.541 +   typedef __int64 int64_t;
   1.542 +   typedef unsigned __int64 uint64_t;
   1.543 +#  define UINT64_C(v) v ## UI64
   1.544 +#  define  INT64_C(v) v ## I64
   1.545 +#  ifndef PRINTF_INT64_MODIFIER
   1.546 +#   define PRINTF_INT64_MODIFIER "I64"
   1.547 +#  endif
   1.548 +# endif
   1.549 +#endif
   1.550 +
   1.551 +#if !defined (LONG_LONG_MAX) && defined (INT64_C)
   1.552 +# define LONG_LONG_MAX INT64_C (9223372036854775807)
   1.553 +#endif
   1.554 +#ifndef ULONG_LONG_MAX
   1.555 +# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
   1.556 +#endif
   1.557 +
   1.558 +#if !defined (INT64_MAX) && defined (INT64_C)
   1.559 +# define INT64_MAX INT64_C (9223372036854775807)
   1.560 +#endif
   1.561 +#if !defined (INT64_MIN) && defined (INT64_C)
   1.562 +# define INT64_MIN INT64_C (-9223372036854775808)
   1.563 +#endif
   1.564 +#if !defined (UINT64_MAX) && defined (INT64_C)
   1.565 +# define UINT64_MAX UINT64_C (18446744073709551615)
   1.566 +#endif
   1.567 +
   1.568 +/*
   1.569 + *  Width of hexadecimal for number field.
   1.570 + */
   1.571 +
   1.572 +#ifndef PRINTF_INT64_HEX_WIDTH
   1.573 +# define PRINTF_INT64_HEX_WIDTH "16"
   1.574 +#endif
   1.575 +#ifndef PRINTF_INT32_HEX_WIDTH
   1.576 +# define PRINTF_INT32_HEX_WIDTH "8"
   1.577 +#endif
   1.578 +#ifndef PRINTF_INT16_HEX_WIDTH
   1.579 +# define PRINTF_INT16_HEX_WIDTH "4"
   1.580 +#endif
   1.581 +#ifndef PRINTF_INT8_HEX_WIDTH
   1.582 +# define PRINTF_INT8_HEX_WIDTH "2"
   1.583 +#endif
   1.584 +#ifndef PRINTF_INT64_DEC_WIDTH
   1.585 +# define PRINTF_INT64_DEC_WIDTH "19"
   1.586 +#endif
   1.587 +#ifndef PRINTF_INT32_DEC_WIDTH
   1.588 +# define PRINTF_INT32_DEC_WIDTH "10"
   1.589 +#endif
   1.590 +#ifndef PRINTF_INT16_DEC_WIDTH
   1.591 +# define PRINTF_INT16_DEC_WIDTH "5"
   1.592 +#endif
   1.593 +#ifndef PRINTF_INT8_DEC_WIDTH
   1.594 +# define PRINTF_INT8_DEC_WIDTH "3"
   1.595 +#endif
   1.596 +#ifndef PRINTF_UINT64_DEC_WIDTH
   1.597 +# define PRINTF_UINT64_DEC_WIDTH "20"
   1.598 +#endif
   1.599 +#ifndef PRINTF_UINT32_DEC_WIDTH
   1.600 +# define PRINTF_UINT32_DEC_WIDTH "10"
   1.601 +#endif
   1.602 +#ifndef PRINTF_UINT16_DEC_WIDTH
   1.603 +# define PRINTF_UINT16_DEC_WIDTH "5"
   1.604 +#endif
   1.605 +#ifndef PRINTF_UINT8_DEC_WIDTH
   1.606 +# define PRINTF_UINT8_DEC_WIDTH "3"
   1.607 +#endif
   1.608 +
   1.609 +/*
   1.610 + *  Ok, lets not worry about 128 bit integers for now.  Moore's law says
   1.611 + *  we don't need to worry about that until about 2040 at which point
   1.612 + *  we'll have bigger things to worry about.
   1.613 + */
   1.614 +
   1.615 +#ifdef stdint_int64_defined
   1.616 +  typedef int64_t intmax_t;
   1.617 +  typedef uint64_t uintmax_t;
   1.618 +# define  INTMAX_MAX   INT64_MAX
   1.619 +# define  INTMAX_MIN   INT64_MIN
   1.620 +# define UINTMAX_MAX  UINT64_MAX
   1.621 +# define UINTMAX_C(v) UINT64_C(v)
   1.622 +# define  INTMAX_C(v)  INT64_C(v)
   1.623 +# ifndef PRINTF_INTMAX_MODIFIER
   1.624 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
   1.625 +# endif
   1.626 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.627 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
   1.628 +# endif
   1.629 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.630 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
   1.631 +# endif
   1.632 +#else
   1.633 +  typedef int32_t intmax_t;
   1.634 +  typedef uint32_t uintmax_t;
   1.635 +# define  INTMAX_MAX   INT32_MAX
   1.636 +# define UINTMAX_MAX  UINT32_MAX
   1.637 +# define UINTMAX_C(v) UINT32_C(v)
   1.638 +# define  INTMAX_C(v)  INT32_C(v)
   1.639 +# ifndef PRINTF_INTMAX_MODIFIER
   1.640 +#   define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
   1.641 +# endif
   1.642 +# ifndef PRINTF_INTMAX_HEX_WIDTH
   1.643 +#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
   1.644 +# endif
   1.645 +# ifndef PRINTF_INTMAX_DEC_WIDTH
   1.646 +#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
   1.647 +# endif
   1.648 +#endif
   1.649 +
   1.650 +/*
   1.651 + *  Because this file currently only supports platforms which have
   1.652 + *  precise powers of 2 as bit sizes for the default integers, the
   1.653 + *  least definitions are all trivial.  Its possible that a future
   1.654 + *  version of this file could have different definitions.
   1.655 + */
   1.656 +
   1.657 +#ifndef stdint_least_defined
   1.658 +  typedef   int8_t   int_least8_t;
   1.659 +  typedef  uint8_t  uint_least8_t;
   1.660 +  typedef  int16_t  int_least16_t;
   1.661 +  typedef uint16_t uint_least16_t;
   1.662 +  typedef  int32_t  int_least32_t;
   1.663 +  typedef uint32_t uint_least32_t;
   1.664 +# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
   1.665 +# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
   1.666 +# define  UINT_LEAST8_MAX  UINT8_MAX
   1.667 +# define   INT_LEAST8_MAX   INT8_MAX
   1.668 +# define UINT_LEAST16_MAX UINT16_MAX
   1.669 +# define  INT_LEAST16_MAX  INT16_MAX
   1.670 +# define UINT_LEAST32_MAX UINT32_MAX
   1.671 +# define  INT_LEAST32_MAX  INT32_MAX
   1.672 +# define   INT_LEAST8_MIN   INT8_MIN
   1.673 +# define  INT_LEAST16_MIN  INT16_MIN
   1.674 +# define  INT_LEAST32_MIN  INT32_MIN
   1.675 +# ifdef stdint_int64_defined
   1.676 +    typedef  int64_t  int_least64_t;
   1.677 +    typedef uint64_t uint_least64_t;
   1.678 +#   define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
   1.679 +#   define UINT_LEAST64_MAX UINT64_MAX
   1.680 +#   define  INT_LEAST64_MAX  INT64_MAX
   1.681 +#   define  INT_LEAST64_MIN  INT64_MIN
   1.682 +# endif
   1.683 +#endif
   1.684 +#undef stdint_least_defined
   1.685 +
   1.686 +/*
   1.687 + *  The ANSI C committee pretending to know or specify anything about
   1.688 + *  performance is the epitome of misguided arrogance.  The mandate of
   1.689 + *  this file is to *ONLY* ever support that absolute minimum
   1.690 + *  definition of the fast integer types, for compatibility purposes.
   1.691 + *  No extensions, and no attempt to suggest what may or may not be a
   1.692 + *  faster integer type will ever be made in this file.  Developers are
   1.693 + *  warned to stay away from these types when using this or any other
   1.694 + *  stdint.h.
   1.695 + */
   1.696 +
   1.697 +typedef   int_least8_t   int_fast8_t;
   1.698 +typedef  uint_least8_t  uint_fast8_t;
   1.699 +typedef  int_least16_t  int_fast16_t;
   1.700 +typedef uint_least16_t uint_fast16_t;
   1.701 +typedef  int_least32_t  int_fast32_t;
   1.702 +typedef uint_least32_t uint_fast32_t;
   1.703 +#define  UINT_FAST8_MAX  UINT_LEAST8_MAX
   1.704 +#define   INT_FAST8_MAX   INT_LEAST8_MAX
   1.705 +#define UINT_FAST16_MAX UINT_LEAST16_MAX
   1.706 +#define  INT_FAST16_MAX  INT_LEAST16_MAX
   1.707 +#define UINT_FAST32_MAX UINT_LEAST32_MAX
   1.708 +#define  INT_FAST32_MAX  INT_LEAST32_MAX
   1.709 +#define   INT_FAST8_MIN   INT_LEAST8_MIN
   1.710 +#define  INT_FAST16_MIN  INT_LEAST16_MIN
   1.711 +#define  INT_FAST32_MIN  INT_LEAST32_MIN
   1.712 +#ifdef stdint_int64_defined
   1.713 +  typedef  int_least64_t  int_fast64_t;
   1.714 +  typedef uint_least64_t uint_fast64_t;
   1.715 +# define UINT_FAST64_MAX UINT_LEAST64_MAX
   1.716 +# define  INT_FAST64_MAX  INT_LEAST64_MAX
   1.717 +# define  INT_FAST64_MIN  INT_LEAST64_MIN
   1.718 +#endif
   1.719 +
   1.720 +#undef stdint_int64_defined
   1.721 +
   1.722 +/*
   1.723 + *  Whatever piecemeal, per compiler thing we can do about the wchar_t
   1.724 + *  type limits.
   1.725 + */
   1.726 +
   1.727 +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)
   1.728 +# include <wchar.h>
   1.729 +# ifndef WCHAR_MIN
   1.730 +#  define WCHAR_MIN 0
   1.731 +# endif
   1.732 +# ifndef WCHAR_MAX
   1.733 +#  define WCHAR_MAX ((wchar_t)-1)
   1.734 +# endif
   1.735 +#endif
   1.736 +
   1.737 +/*
   1.738 + *  Whatever piecemeal, per compiler/platform thing we can do about the
   1.739 + *  (u)intptr_t types and limits.
   1.740 + */
   1.741 +
   1.742 +#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
   1.743 +# define STDINT_H_UINTPTR_T_DEFINED
   1.744 +#endif
   1.745 +
   1.746 +#ifndef STDINT_H_UINTPTR_T_DEFINED
   1.747 +# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
   1.748 +#  define stdint_intptr_bits 64
   1.749 +# elif defined (__WATCOMC__) || defined (__TURBOC__)
   1.750 +#  if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
   1.751 +#    define stdint_intptr_bits 16
   1.752 +#  else
   1.753 +#    define stdint_intptr_bits 32
   1.754 +#  endif
   1.755 +# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
   1.756 +#  define stdint_intptr_bits 32
   1.757 +# elif defined (__INTEL_COMPILER)
   1.758 +/* TODO -- what did Intel do about x86-64? */
   1.759 +# else
   1.760 +/* #error "This platform might not be supported yet" */
   1.761 +# endif
   1.762 +
   1.763 +# ifdef stdint_intptr_bits
   1.764 +#  define stdint_intptr_glue3_i(a,b,c)  a##b##c
   1.765 +#  define stdint_intptr_glue3(a,b,c)    stdint_intptr_glue3_i(a,b,c)
   1.766 +#  ifndef PRINTF_INTPTR_MODIFIER
   1.767 +#    define PRINTF_INTPTR_MODIFIER      stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
   1.768 +#  endif
   1.769 +#  ifndef PTRDIFF_MAX
   1.770 +#    define PTRDIFF_MAX                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   1.771 +#  endif
   1.772 +#  ifndef PTRDIFF_MIN
   1.773 +#    define PTRDIFF_MIN                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   1.774 +#  endif
   1.775 +#  ifndef UINTPTR_MAX
   1.776 +#    define UINTPTR_MAX                 stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
   1.777 +#  endif
   1.778 +#  ifndef INTPTR_MAX
   1.779 +#    define INTPTR_MAX                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
   1.780 +#  endif
   1.781 +#  ifndef INTPTR_MIN
   1.782 +#    define INTPTR_MIN                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
   1.783 +#  endif
   1.784 +#  ifndef INTPTR_C
   1.785 +#    define INTPTR_C(x)                 stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
   1.786 +#  endif
   1.787 +#  ifndef UINTPTR_C
   1.788 +#    define UINTPTR_C(x)                stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
   1.789 +#  endif
   1.790 +  typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
   1.791 +  typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t)  intptr_t;
   1.792 +# else
   1.793 +/* TODO -- This following is likely wrong for some platforms, and does
   1.794 +   nothing for the definition of uintptr_t. */
   1.795 +  typedef ptrdiff_t intptr_t;
   1.796 +# endif
   1.797 +# define STDINT_H_UINTPTR_T_DEFINED
   1.798 +#endif
   1.799 +
   1.800 +/*
   1.801 + *  Assumes sig_atomic_t is signed and we have a 2s complement machine.
   1.802 + */
   1.803 +
   1.804 +#ifndef SIG_ATOMIC_MAX
   1.805 +# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
   1.806 +#endif
   1.807 +
   1.808 +#endif
   1.809 +
   1.810 +#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
   1.811 +
   1.812 +/*
   1.813 + *  Please compile with the maximum warning settings to make sure macros are
   1.814 + *  not defined more than once.
   1.815 + */
   1.816 +
   1.817 +#include <stdlib.h>
   1.818 +#include <stdio.h>
   1.819 +#include <string.h>
   1.820 +
   1.821 +#define glue3_aux(x,y,z) x ## y ## z
   1.822 +#define glue3(x,y,z) glue3_aux(x,y,z)
   1.823 +
   1.824 +#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
   1.825 +#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
   1.826 +
   1.827 +#define DECL(us,bits) glue3(DECL,us,) (bits)
   1.828 +
   1.829 +#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits)
   1.830 +
   1.831 +#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }
   1.832 +
   1.833 +int main () {
   1.834 +	int err_n = 0;
   1.835 +	int err_first = 0;
   1.836 +	DECL(I,8)
   1.837 +	DECL(U,8)
   1.838 +	DECL(I,16)
   1.839 +	DECL(U,16)
   1.840 +	DECL(I,32)
   1.841 +	DECL(U,32)
   1.842 +#ifdef INT64_MAX
   1.843 +	DECL(I,64)
   1.844 +	DECL(U,64)
   1.845 +#endif
   1.846 +	intmax_t imax = INTMAX_C(0);
   1.847 +	uintmax_t umax = UINTMAX_C(0);
   1.848 +	char str0[256], str1[256];
   1.849 +
   1.850 +	sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647));
   1.851 +	if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
   1.852 +	if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH));
   1.853 +	sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295));
   1.854 +	if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
   1.855 +	if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH));
   1.856 +#ifdef INT64_MAX
   1.857 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807));
   1.858 +	if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
   1.859 +	if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));
   1.860 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591));
   1.861 +	if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
   1.862 +	if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));
   1.863 +#endif
   1.864 +
   1.865 +	sprintf (str0, "%d %x\n", 0, ~0);
   1.866 +
   1.867 +	sprintf (str1, "%d %x\n",  i8, ~0);
   1.868 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1));
   1.869 +	sprintf (str1, "%u %x\n",  u8, ~0);
   1.870 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1));
   1.871 +	sprintf (str1, "%d %x\n",  i16, ~0);
   1.872 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1));
   1.873 +	sprintf (str1, "%u %x\n",  u16, ~0);
   1.874 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1));
   1.875 +	sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n",  i32, ~0);
   1.876 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1));
   1.877 +	sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n",  u32, ~0);
   1.878 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1));
   1.879 +#ifdef INT64_MAX
   1.880 +	sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n",  i64, ~0);
   1.881 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1));
   1.882 +#endif
   1.883 +	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n",  imax, ~0);
   1.884 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1));
   1.885 +	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n",  umax, ~0);
   1.886 +	if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1));
   1.887 +
   1.888 +	TESTUMAX(8);
   1.889 +	TESTUMAX(16);
   1.890 +	TESTUMAX(32);
   1.891 +#ifdef INT64_MAX
   1.892 +	TESTUMAX(64);
   1.893 +#endif
   1.894 +
   1.895 +#define STR(v) #v
   1.896 +#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v));
   1.897 +	if (err_n) {
   1.898 +		printf ("pstdint.h is not correct.  Please use sizes below to correct it:\n");
   1.899 +	}
   1.900 +
   1.901 +	Q(int)
   1.902 +	Q(unsigned)
   1.903 +	Q(long int)
   1.904 +	Q(short int)
   1.905 +	Q(int8_t)
   1.906 +	Q(int16_t)
   1.907 +	Q(int32_t)
   1.908 +#ifdef INT64_MAX
   1.909 +	Q(int64_t)
   1.910 +#endif
   1.911 +
   1.912 +	return EXIT_SUCCESS;
   1.913 +}
   1.914 +
   1.915 +#endif