vrshoot

annotate libs/assimp/pstdint.h @ 3:c179c72369be

rename candy->vr
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 03 Feb 2014 08:52:13 +0200
parents
children
rev   line source
nuclear@0 1 /* A portable stdint.h
nuclear@0 2 ****************************************************************************
nuclear@0 3 * BSD License:
nuclear@0 4 ****************************************************************************
nuclear@0 5 *
nuclear@0 6 * Copyright (c) 2005-2007 Paul Hsieh
nuclear@0 7 * All rights reserved.
nuclear@0 8 *
nuclear@0 9 * Redistribution and use in source and binary forms, with or without
nuclear@0 10 * modification, are permitted provided that the following conditions
nuclear@0 11 * are met:
nuclear@0 12 *
nuclear@0 13 * 1. Redistributions of source code must retain the above copyright
nuclear@0 14 * notice, this list of conditions and the following disclaimer.
nuclear@0 15 * 2. Redistributions in binary form must reproduce the above copyright
nuclear@0 16 * notice, this list of conditions and the following disclaimer in the
nuclear@0 17 * documentation and/or other materials provided with the distribution.
nuclear@0 18 * 3. The name of the author may not be used to endorse or promote products
nuclear@0 19 * derived from this software without specific prior written permission.
nuclear@0 20 *
nuclear@0 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
nuclear@0 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
nuclear@0 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
nuclear@0 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
nuclear@0 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
nuclear@0 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
nuclear@0 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nuclear@0 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nuclear@0 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
nuclear@0 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nuclear@0 31 *
nuclear@0 32 ****************************************************************************
nuclear@0 33 *
nuclear@0 34 * Version 0.1.10
nuclear@0 35 *
nuclear@0 36 * The ANSI C standard committee, for the C99 standard, specified the
nuclear@0 37 * inclusion of a new standard include file called stdint.h. This is
nuclear@0 38 * a very useful and long desired include file which contains several
nuclear@0 39 * very precise definitions for integer scalar types that is
nuclear@0 40 * critically important for making portable several classes of
nuclear@0 41 * applications including cryptography, hashing, variable length
nuclear@0 42 * integer libraries and so on. But for most developers its likely
nuclear@0 43 * useful just for programming sanity.
nuclear@0 44 *
nuclear@0 45 * The problem is that most compiler vendors have decided not to
nuclear@0 46 * implement the C99 standard, and the next C++ language standard
nuclear@0 47 * (which has a lot more mindshare these days) will be a long time in
nuclear@0 48 * coming and its unknown whether or not it will include stdint.h or
nuclear@0 49 * how much adoption it will have. Either way, it will be a long time
nuclear@0 50 * before all compilers come with a stdint.h and it also does nothing
nuclear@0 51 * for the extremely large number of compilers available today which
nuclear@0 52 * do not include this file, or anything comparable to it.
nuclear@0 53 *
nuclear@0 54 * So that's what this file is all about. Its an attempt to build a
nuclear@0 55 * single universal include file that works on as many platforms as
nuclear@0 56 * possible to deliver what stdint.h is supposed to. A few things
nuclear@0 57 * that should be noted about this file:
nuclear@0 58 *
nuclear@0 59 * 1) It is not guaranteed to be portable and/or present an identical
nuclear@0 60 * interface on all platforms. The extreme variability of the
nuclear@0 61 * ANSI C standard makes this an impossibility right from the
nuclear@0 62 * very get go. Its really only meant to be useful for the vast
nuclear@0 63 * majority of platforms that possess the capability of
nuclear@0 64 * implementing usefully and precisely defined, standard sized
nuclear@0 65 * integer scalars. Systems which are not intrinsically 2s
nuclear@0 66 * complement may produce invalid constants.
nuclear@0 67 *
nuclear@0 68 * 2) There is an unavoidable use of non-reserved symbols.
nuclear@0 69 *
nuclear@0 70 * 3) Other standard include files are invoked.
nuclear@0 71 *
nuclear@0 72 * 4) This file may come in conflict with future platforms that do
nuclear@0 73 * include stdint.h. The hope is that one or the other can be
nuclear@0 74 * used with no real difference.
nuclear@0 75 *
nuclear@0 76 * 5) In the current verison, if your platform can't represent
nuclear@0 77 * int32_t, int16_t and int8_t, it just dumps out with a compiler
nuclear@0 78 * error.
nuclear@0 79 *
nuclear@0 80 * 6) 64 bit integers may or may not be defined. Test for their
nuclear@0 81 * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
nuclear@0 82 * Note that this is different from the C99 specification which
nuclear@0 83 * requires the existence of 64 bit support in the compiler. If
nuclear@0 84 * this is not defined for your platform, yet it is capable of
nuclear@0 85 * dealing with 64 bits then it is because this file has not yet
nuclear@0 86 * been extended to cover all of your system's capabilities.
nuclear@0 87 *
nuclear@0 88 * 7) (u)intptr_t may or may not be defined. Test for its presence
nuclear@0 89 * with the test: #ifdef PTRDIFF_MAX. If this is not defined
nuclear@0 90 * for your platform, then it is because this file has not yet
nuclear@0 91 * been extended to cover all of your system's capabilities, not
nuclear@0 92 * because its optional.
nuclear@0 93 *
nuclear@0 94 * 8) The following might not been defined even if your platform is
nuclear@0 95 * capable of defining it:
nuclear@0 96 *
nuclear@0 97 * WCHAR_MIN
nuclear@0 98 * WCHAR_MAX
nuclear@0 99 * (u)int64_t
nuclear@0 100 * PTRDIFF_MIN
nuclear@0 101 * PTRDIFF_MAX
nuclear@0 102 * (u)intptr_t
nuclear@0 103 *
nuclear@0 104 * 9) The following have not been defined:
nuclear@0 105 *
nuclear@0 106 * WINT_MIN
nuclear@0 107 * WINT_MAX
nuclear@0 108 *
nuclear@0 109 * 10) The criteria for defining (u)int_least(*)_t isn't clear,
nuclear@0 110 * except for systems which don't have a type that precisely
nuclear@0 111 * defined 8, 16, or 32 bit types (which this include file does
nuclear@0 112 * not support anyways). Default definitions have been given.
nuclear@0 113 *
nuclear@0 114 * 11) The criteria for defining (u)int_fast(*)_t isn't something I
nuclear@0 115 * would trust to any particular compiler vendor or the ANSI C
nuclear@0 116 * committee. It is well known that "compatible systems" are
nuclear@0 117 * commonly created that have very different performance
nuclear@0 118 * characteristics from the systems they are compatible with,
nuclear@0 119 * especially those whose vendors make both the compiler and the
nuclear@0 120 * system. Default definitions have been given, but its strongly
nuclear@0 121 * recommended that users never use these definitions for any
nuclear@0 122 * reason (they do *NOT* deliver any serious guarantee of
nuclear@0 123 * improved performance -- not in this file, nor any vendor's
nuclear@0 124 * stdint.h).
nuclear@0 125 *
nuclear@0 126 * 12) The following macros:
nuclear@0 127 *
nuclear@0 128 * PRINTF_INTMAX_MODIFIER
nuclear@0 129 * PRINTF_INT64_MODIFIER
nuclear@0 130 * PRINTF_INT32_MODIFIER
nuclear@0 131 * PRINTF_INT16_MODIFIER
nuclear@0 132 * PRINTF_LEAST64_MODIFIER
nuclear@0 133 * PRINTF_LEAST32_MODIFIER
nuclear@0 134 * PRINTF_LEAST16_MODIFIER
nuclear@0 135 * PRINTF_INTPTR_MODIFIER
nuclear@0 136 *
nuclear@0 137 * are strings which have been defined as the modifiers required
nuclear@0 138 * for the "d", "u" and "x" printf formats to correctly output
nuclear@0 139 * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
nuclear@0 140 * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
nuclear@0 141 * PRINTF_INTPTR_MODIFIER is not defined for some systems which
nuclear@0 142 * provide their own stdint.h. PRINTF_INT64_MODIFIER is not
nuclear@0 143 * defined if INT64_MAX is not defined. These are an extension
nuclear@0 144 * beyond what C99 specifies must be in stdint.h.
nuclear@0 145 *
nuclear@0 146 * In addition, the following macros are defined:
nuclear@0 147 *
nuclear@0 148 * PRINTF_INTMAX_HEX_WIDTH
nuclear@0 149 * PRINTF_INT64_HEX_WIDTH
nuclear@0 150 * PRINTF_INT32_HEX_WIDTH
nuclear@0 151 * PRINTF_INT16_HEX_WIDTH
nuclear@0 152 * PRINTF_INT8_HEX_WIDTH
nuclear@0 153 * PRINTF_INTMAX_DEC_WIDTH
nuclear@0 154 * PRINTF_INT64_DEC_WIDTH
nuclear@0 155 * PRINTF_INT32_DEC_WIDTH
nuclear@0 156 * PRINTF_INT16_DEC_WIDTH
nuclear@0 157 * PRINTF_INT8_DEC_WIDTH
nuclear@0 158 *
nuclear@0 159 * Which specifies the maximum number of characters required to
nuclear@0 160 * print the number of that type in either hexadecimal or decimal.
nuclear@0 161 * These are an extension beyond what C99 specifies must be in
nuclear@0 162 * stdint.h.
nuclear@0 163 *
nuclear@0 164 * Compilers tested (all with 0 warnings at their highest respective
nuclear@0 165 * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
nuclear@0 166 * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
nuclear@0 167 * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
nuclear@0 168 *
nuclear@0 169 * This file should be considered a work in progress. Suggestions for
nuclear@0 170 * improvements, especially those which increase coverage are strongly
nuclear@0 171 * encouraged.
nuclear@0 172 *
nuclear@0 173 * Acknowledgements
nuclear@0 174 *
nuclear@0 175 * The following people have made significant contributions to the
nuclear@0 176 * development and testing of this file:
nuclear@0 177 *
nuclear@0 178 * Chris Howie
nuclear@0 179 * John Steele Scott
nuclear@0 180 * Dave Thorup
nuclear@0 181 *
nuclear@0 182 */
nuclear@0 183
nuclear@0 184 #include <stddef.h>
nuclear@0 185 #include <limits.h>
nuclear@0 186 #include <signal.h>
nuclear@0 187
nuclear@0 188 /*
nuclear@0 189 * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
nuclear@0 190 * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
nuclear@0 191 */
nuclear@0 192
nuclear@0 193 #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)
nuclear@0 194 #include <stdint.h>
nuclear@0 195 #define _PSTDINT_H_INCLUDED
nuclear@0 196 # ifndef PRINTF_INT64_MODIFIER
nuclear@0 197 # define PRINTF_INT64_MODIFIER "ll"
nuclear@0 198 # endif
nuclear@0 199 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 200 # define PRINTF_INT32_MODIFIER "l"
nuclear@0 201 # endif
nuclear@0 202 # ifndef PRINTF_INT16_MODIFIER
nuclear@0 203 # define PRINTF_INT16_MODIFIER "h"
nuclear@0 204 # endif
nuclear@0 205 # ifndef PRINTF_INTMAX_MODIFIER
nuclear@0 206 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
nuclear@0 207 # endif
nuclear@0 208 # ifndef PRINTF_INT64_HEX_WIDTH
nuclear@0 209 # define PRINTF_INT64_HEX_WIDTH "16"
nuclear@0 210 # endif
nuclear@0 211 # ifndef PRINTF_INT32_HEX_WIDTH
nuclear@0 212 # define PRINTF_INT32_HEX_WIDTH "8"
nuclear@0 213 # endif
nuclear@0 214 # ifndef PRINTF_INT16_HEX_WIDTH
nuclear@0 215 # define PRINTF_INT16_HEX_WIDTH "4"
nuclear@0 216 # endif
nuclear@0 217 # ifndef PRINTF_INT8_HEX_WIDTH
nuclear@0 218 # define PRINTF_INT8_HEX_WIDTH "2"
nuclear@0 219 # endif
nuclear@0 220 # ifndef PRINTF_INT64_DEC_WIDTH
nuclear@0 221 # define PRINTF_INT64_DEC_WIDTH "20"
nuclear@0 222 # endif
nuclear@0 223 # ifndef PRINTF_INT32_DEC_WIDTH
nuclear@0 224 # define PRINTF_INT32_DEC_WIDTH "10"
nuclear@0 225 # endif
nuclear@0 226 # ifndef PRINTF_INT16_DEC_WIDTH
nuclear@0 227 # define PRINTF_INT16_DEC_WIDTH "5"
nuclear@0 228 # endif
nuclear@0 229 # ifndef PRINTF_INT8_DEC_WIDTH
nuclear@0 230 # define PRINTF_INT8_DEC_WIDTH "3"
nuclear@0 231 # endif
nuclear@0 232 # ifndef PRINTF_INTMAX_HEX_WIDTH
nuclear@0 233 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
nuclear@0 234 # endif
nuclear@0 235 # ifndef PRINTF_INTMAX_DEC_WIDTH
nuclear@0 236 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
nuclear@0 237 # endif
nuclear@0 238
nuclear@0 239 /*
nuclear@0 240 * Something really weird is going on with Open Watcom. Just pull some of
nuclear@0 241 * these duplicated definitions from Open Watcom's stdint.h file for now.
nuclear@0 242 */
nuclear@0 243
nuclear@0 244 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
nuclear@0 245 # if !defined (INT64_C)
nuclear@0 246 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
nuclear@0 247 # endif
nuclear@0 248 # if !defined (UINT64_C)
nuclear@0 249 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
nuclear@0 250 # endif
nuclear@0 251 # if !defined (INT32_C)
nuclear@0 252 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
nuclear@0 253 # endif
nuclear@0 254 # if !defined (UINT32_C)
nuclear@0 255 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
nuclear@0 256 # endif
nuclear@0 257 # if !defined (INT16_C)
nuclear@0 258 # define INT16_C(x) (x)
nuclear@0 259 # endif
nuclear@0 260 # if !defined (UINT16_C)
nuclear@0 261 # define UINT16_C(x) (x)
nuclear@0 262 # endif
nuclear@0 263 # if !defined (INT8_C)
nuclear@0 264 # define INT8_C(x) (x)
nuclear@0 265 # endif
nuclear@0 266 # if !defined (UINT8_C)
nuclear@0 267 # define UINT8_C(x) (x)
nuclear@0 268 # endif
nuclear@0 269 # if !defined (UINT64_MAX)
nuclear@0 270 # define UINT64_MAX 18446744073709551615ULL
nuclear@0 271 # endif
nuclear@0 272 # if !defined (INT64_MAX)
nuclear@0 273 # define INT64_MAX 9223372036854775807LL
nuclear@0 274 # endif
nuclear@0 275 # if !defined (UINT32_MAX)
nuclear@0 276 # define UINT32_MAX 4294967295UL
nuclear@0 277 # endif
nuclear@0 278 # if !defined (INT32_MAX)
nuclear@0 279 # define INT32_MAX 2147483647L
nuclear@0 280 # endif
nuclear@0 281 # if !defined (INTMAX_MAX)
nuclear@0 282 # define INTMAX_MAX INT64_MAX
nuclear@0 283 # endif
nuclear@0 284 # if !defined (INTMAX_MIN)
nuclear@0 285 # define INTMAX_MIN INT64_MIN
nuclear@0 286 # endif
nuclear@0 287 # endif
nuclear@0 288 #endif
nuclear@0 289
nuclear@0 290 #ifndef _PSTDINT_H_INCLUDED
nuclear@0 291 #define _PSTDINT_H_INCLUDED
nuclear@0 292
nuclear@0 293 #ifndef SIZE_MAX
nuclear@0 294 # define SIZE_MAX (~(size_t)0)
nuclear@0 295 #endif
nuclear@0 296
nuclear@0 297 /*
nuclear@0 298 * Deduce the type assignments from limits.h under the assumption that
nuclear@0 299 * integer sizes in bits are powers of 2, and follow the ANSI
nuclear@0 300 * definitions.
nuclear@0 301 */
nuclear@0 302
nuclear@0 303 #ifndef UINT8_MAX
nuclear@0 304 # define UINT8_MAX 0xff
nuclear@0 305 #endif
nuclear@0 306 #ifndef uint8_t
nuclear@0 307 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
nuclear@0 308 typedef unsigned char uint8_t;
nuclear@0 309 # define UINT8_C(v) ((uint8_t) v)
nuclear@0 310 # else
nuclear@0 311 # error "Platform not supported"
nuclear@0 312 # endif
nuclear@0 313 #endif
nuclear@0 314
nuclear@0 315 #ifndef INT8_MAX
nuclear@0 316 # define INT8_MAX 0x7f
nuclear@0 317 #endif
nuclear@0 318 #ifndef INT8_MIN
nuclear@0 319 # define INT8_MIN INT8_C(0x80)
nuclear@0 320 #endif
nuclear@0 321 #ifndef int8_t
nuclear@0 322 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
nuclear@0 323 typedef signed char int8_t;
nuclear@0 324 # define INT8_C(v) ((int8_t) v)
nuclear@0 325 # else
nuclear@0 326 # error "Platform not supported"
nuclear@0 327 # endif
nuclear@0 328 #endif
nuclear@0 329
nuclear@0 330 #ifndef UINT16_MAX
nuclear@0 331 # define UINT16_MAX 0xffff
nuclear@0 332 #endif
nuclear@0 333 #ifndef uint16_t
nuclear@0 334 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
nuclear@0 335 typedef unsigned int uint16_t;
nuclear@0 336 # ifndef PRINTF_INT16_MODIFIER
nuclear@0 337 # define PRINTF_INT16_MODIFIER ""
nuclear@0 338 # endif
nuclear@0 339 # define UINT16_C(v) ((uint16_t) (v))
nuclear@0 340 #elif (USHRT_MAX == UINT16_MAX)
nuclear@0 341 typedef unsigned short uint16_t;
nuclear@0 342 # define UINT16_C(v) ((uint16_t) (v))
nuclear@0 343 # ifndef PRINTF_INT16_MODIFIER
nuclear@0 344 # define PRINTF_INT16_MODIFIER "h"
nuclear@0 345 # endif
nuclear@0 346 #else
nuclear@0 347 #error "Platform not supported"
nuclear@0 348 #endif
nuclear@0 349 #endif
nuclear@0 350
nuclear@0 351 #ifndef INT16_MAX
nuclear@0 352 # define INT16_MAX 0x7fff
nuclear@0 353 #endif
nuclear@0 354 #ifndef INT16_MIN
nuclear@0 355 # define INT16_MIN INT16_C(0x8000)
nuclear@0 356 #endif
nuclear@0 357 #ifndef int16_t
nuclear@0 358 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
nuclear@0 359 typedef signed int int16_t;
nuclear@0 360 # define INT16_C(v) ((int16_t) (v))
nuclear@0 361 # ifndef PRINTF_INT16_MODIFIER
nuclear@0 362 # define PRINTF_INT16_MODIFIER ""
nuclear@0 363 # endif
nuclear@0 364 #elif (SHRT_MAX == INT16_MAX)
nuclear@0 365 typedef signed short int16_t;
nuclear@0 366 # define INT16_C(v) ((int16_t) (v))
nuclear@0 367 # ifndef PRINTF_INT16_MODIFIER
nuclear@0 368 # define PRINTF_INT16_MODIFIER "h"
nuclear@0 369 # endif
nuclear@0 370 #else
nuclear@0 371 #error "Platform not supported"
nuclear@0 372 #endif
nuclear@0 373 #endif
nuclear@0 374
nuclear@0 375 #ifndef UINT32_MAX
nuclear@0 376 # define UINT32_MAX (0xffffffffUL)
nuclear@0 377 #endif
nuclear@0 378 #ifndef uint32_t
nuclear@0 379 #if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
nuclear@0 380 typedef unsigned long uint32_t;
nuclear@0 381 # define UINT32_C(v) v ## UL
nuclear@0 382 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 383 # define PRINTF_INT32_MODIFIER "l"
nuclear@0 384 # endif
nuclear@0 385 #elif (UINT_MAX == UINT32_MAX)
nuclear@0 386 typedef unsigned int uint32_t;
nuclear@0 387 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 388 # define PRINTF_INT32_MODIFIER ""
nuclear@0 389 # endif
nuclear@0 390 # define UINT32_C(v) v ## U
nuclear@0 391 #elif (USHRT_MAX == UINT32_MAX)
nuclear@0 392 typedef unsigned short uint32_t;
nuclear@0 393 # define UINT32_C(v) ((unsigned short) (v))
nuclear@0 394 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 395 # define PRINTF_INT32_MODIFIER ""
nuclear@0 396 # endif
nuclear@0 397 #else
nuclear@0 398 #error "Platform not supported"
nuclear@0 399 #endif
nuclear@0 400 #endif
nuclear@0 401
nuclear@0 402 #ifndef INT32_MAX
nuclear@0 403 # define INT32_MAX (0x7fffffffL)
nuclear@0 404 #endif
nuclear@0 405 #ifndef INT32_MIN
nuclear@0 406 # define INT32_MIN INT32_C(0x80000000)
nuclear@0 407 #endif
nuclear@0 408 #ifndef int32_t
nuclear@0 409 #if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
nuclear@0 410 typedef signed long int32_t;
nuclear@0 411 # define INT32_C(v) v ## L
nuclear@0 412 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 413 # define PRINTF_INT32_MODIFIER "l"
nuclear@0 414 # endif
nuclear@0 415 #elif (INT_MAX == INT32_MAX)
nuclear@0 416 typedef signed int int32_t;
nuclear@0 417 # define INT32_C(v) v
nuclear@0 418 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 419 # define PRINTF_INT32_MODIFIER ""
nuclear@0 420 # endif
nuclear@0 421 #elif (SHRT_MAX == INT32_MAX)
nuclear@0 422 typedef signed short int32_t;
nuclear@0 423 # define INT32_C(v) ((short) (v))
nuclear@0 424 # ifndef PRINTF_INT32_MODIFIER
nuclear@0 425 # define PRINTF_INT32_MODIFIER ""
nuclear@0 426 # endif
nuclear@0 427 #else
nuclear@0 428 #error "Platform not supported"
nuclear@0 429 #endif
nuclear@0 430 #endif
nuclear@0 431
nuclear@0 432 /*
nuclear@0 433 * The macro stdint_int64_defined is temporarily used to record
nuclear@0 434 * whether or not 64 integer support is available. It must be
nuclear@0 435 * defined for any 64 integer extensions for new platforms that are
nuclear@0 436 * added.
nuclear@0 437 */
nuclear@0 438
nuclear@0 439 #undef stdint_int64_defined
nuclear@0 440 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
nuclear@0 441 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
nuclear@0 442 # define stdint_int64_defined
nuclear@0 443 typedef long long int64_t;
nuclear@0 444 typedef unsigned long long uint64_t;
nuclear@0 445 # define UINT64_C(v) v ## ULL
nuclear@0 446 # define INT64_C(v) v ## LL
nuclear@0 447 # ifndef PRINTF_INT64_MODIFIER
nuclear@0 448 # define PRINTF_INT64_MODIFIER "ll"
nuclear@0 449 # endif
nuclear@0 450 # endif
nuclear@0 451 #endif
nuclear@0 452
nuclear@0 453 #if !defined (stdint_int64_defined)
nuclear@0 454 # if defined(__GNUC__)
nuclear@0 455 # define stdint_int64_defined
nuclear@0 456 __extension__ typedef long long int64_t;
nuclear@0 457 __extension__ typedef unsigned long long uint64_t;
nuclear@0 458 # define UINT64_C(v) v ## ULL
nuclear@0 459 # define INT64_C(v) v ## LL
nuclear@0 460 # ifndef PRINTF_INT64_MODIFIER
nuclear@0 461 # define PRINTF_INT64_MODIFIER "ll"
nuclear@0 462 # endif
nuclear@0 463 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
nuclear@0 464 # define stdint_int64_defined
nuclear@0 465 typedef long long int64_t;
nuclear@0 466 typedef unsigned long long uint64_t;
nuclear@0 467 # define UINT64_C(v) v ## ULL
nuclear@0 468 # define INT64_C(v) v ## LL
nuclear@0 469 # ifndef PRINTF_INT64_MODIFIER
nuclear@0 470 # define PRINTF_INT64_MODIFIER "ll"
nuclear@0 471 # endif
nuclear@0 472 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
nuclear@0 473 # define stdint_int64_defined
nuclear@0 474 typedef __int64 int64_t;
nuclear@0 475 typedef unsigned __int64 uint64_t;
nuclear@0 476 # define UINT64_C(v) v ## UI64
nuclear@0 477 # define INT64_C(v) v ## I64
nuclear@0 478 # ifndef PRINTF_INT64_MODIFIER
nuclear@0 479 # define PRINTF_INT64_MODIFIER "I64"
nuclear@0 480 # endif
nuclear@0 481 # endif
nuclear@0 482 #endif
nuclear@0 483
nuclear@0 484 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
nuclear@0 485 # define LONG_LONG_MAX INT64_C (9223372036854775807)
nuclear@0 486 #endif
nuclear@0 487 #ifndef ULONG_LONG_MAX
nuclear@0 488 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
nuclear@0 489 #endif
nuclear@0 490
nuclear@0 491 #if !defined (INT64_MAX) && defined (INT64_C)
nuclear@0 492 # define INT64_MAX INT64_C (9223372036854775807)
nuclear@0 493 #endif
nuclear@0 494 #if !defined (INT64_MIN) && defined (INT64_C)
nuclear@0 495 # define INT64_MIN INT64_C (-9223372036854775808)
nuclear@0 496 #endif
nuclear@0 497 #if !defined (UINT64_MAX) && defined (INT64_C)
nuclear@0 498 # define UINT64_MAX UINT64_C (18446744073709551615)
nuclear@0 499 #endif
nuclear@0 500
nuclear@0 501 /*
nuclear@0 502 * Width of hexadecimal for number field.
nuclear@0 503 */
nuclear@0 504
nuclear@0 505 #ifndef PRINTF_INT64_HEX_WIDTH
nuclear@0 506 # define PRINTF_INT64_HEX_WIDTH "16"
nuclear@0 507 #endif
nuclear@0 508 #ifndef PRINTF_INT32_HEX_WIDTH
nuclear@0 509 # define PRINTF_INT32_HEX_WIDTH "8"
nuclear@0 510 #endif
nuclear@0 511 #ifndef PRINTF_INT16_HEX_WIDTH
nuclear@0 512 # define PRINTF_INT16_HEX_WIDTH "4"
nuclear@0 513 #endif
nuclear@0 514 #ifndef PRINTF_INT8_HEX_WIDTH
nuclear@0 515 # define PRINTF_INT8_HEX_WIDTH "2"
nuclear@0 516 #endif
nuclear@0 517
nuclear@0 518 #ifndef PRINTF_INT64_DEC_WIDTH
nuclear@0 519 # define PRINTF_INT64_DEC_WIDTH "20"
nuclear@0 520 #endif
nuclear@0 521 #ifndef PRINTF_INT32_DEC_WIDTH
nuclear@0 522 # define PRINTF_INT32_DEC_WIDTH "10"
nuclear@0 523 #endif
nuclear@0 524 #ifndef PRINTF_INT16_DEC_WIDTH
nuclear@0 525 # define PRINTF_INT16_DEC_WIDTH "5"
nuclear@0 526 #endif
nuclear@0 527 #ifndef PRINTF_INT8_DEC_WIDTH
nuclear@0 528 # define PRINTF_INT8_DEC_WIDTH "3"
nuclear@0 529 #endif
nuclear@0 530
nuclear@0 531 /*
nuclear@0 532 * Ok, lets not worry about 128 bit integers for now. Moore's law says
nuclear@0 533 * we don't need to worry about that until about 2040 at which point
nuclear@0 534 * we'll have bigger things to worry about.
nuclear@0 535 */
nuclear@0 536
nuclear@0 537 #ifdef stdint_int64_defined
nuclear@0 538 typedef int64_t intmax_t;
nuclear@0 539 typedef uint64_t uintmax_t;
nuclear@0 540 # define INTMAX_MAX INT64_MAX
nuclear@0 541 # define INTMAX_MIN INT64_MIN
nuclear@0 542 # define UINTMAX_MAX UINT64_MAX
nuclear@0 543 # define UINTMAX_C(v) UINT64_C(v)
nuclear@0 544 # define INTMAX_C(v) INT64_C(v)
nuclear@0 545 # ifndef PRINTF_INTMAX_MODIFIER
nuclear@0 546 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
nuclear@0 547 # endif
nuclear@0 548 # ifndef PRINTF_INTMAX_HEX_WIDTH
nuclear@0 549 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
nuclear@0 550 # endif
nuclear@0 551 # ifndef PRINTF_INTMAX_DEC_WIDTH
nuclear@0 552 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
nuclear@0 553 # endif
nuclear@0 554 #else
nuclear@0 555 typedef int32_t intmax_t;
nuclear@0 556 typedef uint32_t uintmax_t;
nuclear@0 557 # define INTMAX_MAX INT32_MAX
nuclear@0 558 # define UINTMAX_MAX UINT32_MAX
nuclear@0 559 # define UINTMAX_C(v) UINT32_C(v)
nuclear@0 560 # define INTMAX_C(v) INT32_C(v)
nuclear@0 561 # ifndef PRINTF_INTMAX_MODIFIER
nuclear@0 562 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
nuclear@0 563 # endif
nuclear@0 564 # ifndef PRINTF_INTMAX_HEX_WIDTH
nuclear@0 565 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
nuclear@0 566 # endif
nuclear@0 567 # ifndef PRINTF_INTMAX_DEC_WIDTH
nuclear@0 568 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
nuclear@0 569 # endif
nuclear@0 570 #endif
nuclear@0 571
nuclear@0 572 /*
nuclear@0 573 * Because this file currently only supports platforms which have
nuclear@0 574 * precise powers of 2 as bit sizes for the default integers, the
nuclear@0 575 * least definitions are all trivial. Its possible that a future
nuclear@0 576 * version of this file could have different definitions.
nuclear@0 577 */
nuclear@0 578
nuclear@0 579 #ifndef stdint_least_defined
nuclear@0 580 typedef int8_t int_least8_t;
nuclear@0 581 typedef uint8_t uint_least8_t;
nuclear@0 582 typedef int16_t int_least16_t;
nuclear@0 583 typedef uint16_t uint_least16_t;
nuclear@0 584 typedef int32_t int_least32_t;
nuclear@0 585 typedef uint32_t uint_least32_t;
nuclear@0 586 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
nuclear@0 587 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
nuclear@0 588 # define UINT_LEAST8_MAX UINT8_MAX
nuclear@0 589 # define INT_LEAST8_MAX INT8_MAX
nuclear@0 590 # define UINT_LEAST16_MAX UINT16_MAX
nuclear@0 591 # define INT_LEAST16_MAX INT16_MAX
nuclear@0 592 # define UINT_LEAST32_MAX UINT32_MAX
nuclear@0 593 # define INT_LEAST32_MAX INT32_MAX
nuclear@0 594 # define INT_LEAST8_MIN INT8_MIN
nuclear@0 595 # define INT_LEAST16_MIN INT16_MIN
nuclear@0 596 # define INT_LEAST32_MIN INT32_MIN
nuclear@0 597 # ifdef stdint_int64_defined
nuclear@0 598 typedef int64_t int_least64_t;
nuclear@0 599 typedef uint64_t uint_least64_t;
nuclear@0 600 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
nuclear@0 601 # define UINT_LEAST64_MAX UINT64_MAX
nuclear@0 602 # define INT_LEAST64_MAX INT64_MAX
nuclear@0 603 # define INT_LEAST64_MIN INT64_MIN
nuclear@0 604 # endif
nuclear@0 605 #endif
nuclear@0 606 #undef stdint_least_defined
nuclear@0 607
nuclear@0 608 /*
nuclear@0 609 * The ANSI C committee pretending to know or specify anything about
nuclear@0 610 * performance is the epitome of misguided arrogance. The mandate of
nuclear@0 611 * this file is to *ONLY* ever support that absolute minimum
nuclear@0 612 * definition of the fast integer types, for compatibility purposes.
nuclear@0 613 * No extensions, and no attempt to suggest what may or may not be a
nuclear@0 614 * faster integer type will ever be made in this file. Developers are
nuclear@0 615 * warned to stay away from these types when using this or any other
nuclear@0 616 * stdint.h.
nuclear@0 617 */
nuclear@0 618
nuclear@0 619 typedef int_least8_t int_fast8_t;
nuclear@0 620 typedef uint_least8_t uint_fast8_t;
nuclear@0 621 typedef int_least16_t int_fast16_t;
nuclear@0 622 typedef uint_least16_t uint_fast16_t;
nuclear@0 623 typedef int_least32_t int_fast32_t;
nuclear@0 624 typedef uint_least32_t uint_fast32_t;
nuclear@0 625 #define UINT_FAST8_MAX UINT_LEAST8_MAX
nuclear@0 626 #define INT_FAST8_MAX INT_LEAST8_MAX
nuclear@0 627 #define UINT_FAST16_MAX UINT_LEAST16_MAX
nuclear@0 628 #define INT_FAST16_MAX INT_LEAST16_MAX
nuclear@0 629 #define UINT_FAST32_MAX UINT_LEAST32_MAX
nuclear@0 630 #define INT_FAST32_MAX INT_LEAST32_MAX
nuclear@0 631 #define INT_FAST8_MIN INT_LEAST8_MIN
nuclear@0 632 #define INT_FAST16_MIN INT_LEAST16_MIN
nuclear@0 633 #define INT_FAST32_MIN INT_LEAST32_MIN
nuclear@0 634 #ifdef stdint_int64_defined
nuclear@0 635 typedef int_least64_t int_fast64_t;
nuclear@0 636 typedef uint_least64_t uint_fast64_t;
nuclear@0 637 # define UINT_FAST64_MAX UINT_LEAST64_MAX
nuclear@0 638 # define INT_FAST64_MAX INT_LEAST64_MAX
nuclear@0 639 # define INT_FAST64_MIN INT_LEAST64_MIN
nuclear@0 640 #endif
nuclear@0 641
nuclear@0 642 #undef stdint_int64_defined
nuclear@0 643
nuclear@0 644 /*
nuclear@0 645 * Whatever piecemeal, per compiler thing we can do about the wchar_t
nuclear@0 646 * type limits.
nuclear@0 647 */
nuclear@0 648
nuclear@0 649 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
nuclear@0 650 # include <wchar.h>
nuclear@0 651 # ifndef WCHAR_MIN
nuclear@0 652 # define WCHAR_MIN 0
nuclear@0 653 # endif
nuclear@0 654 # ifndef WCHAR_MAX
nuclear@0 655 # define WCHAR_MAX ((wchar_t)-1)
nuclear@0 656 # endif
nuclear@0 657 #endif
nuclear@0 658
nuclear@0 659 /*
nuclear@0 660 * Whatever piecemeal, per compiler/platform thing we can do about the
nuclear@0 661 * (u)intptr_t types and limits.
nuclear@0 662 */
nuclear@0 663
nuclear@0 664 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
nuclear@0 665 # define STDINT_H_UINTPTR_T_DEFINED
nuclear@0 666 #endif
nuclear@0 667
nuclear@0 668 #ifndef STDINT_H_UINTPTR_T_DEFINED
nuclear@0 669 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
nuclear@0 670 # define stdint_intptr_bits 64
nuclear@0 671 # elif defined (__WATCOMC__) || defined (__TURBOC__)
nuclear@0 672 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
nuclear@0 673 # define stdint_intptr_bits 16
nuclear@0 674 # else
nuclear@0 675 # define stdint_intptr_bits 32
nuclear@0 676 # endif
nuclear@0 677 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
nuclear@0 678 # define stdint_intptr_bits 32
nuclear@0 679 # elif defined (__INTEL_COMPILER)
nuclear@0 680 /* TODO -- what will Intel do about x86-64? */
nuclear@0 681 # endif
nuclear@0 682
nuclear@0 683 # ifdef stdint_intptr_bits
nuclear@0 684 # define stdint_intptr_glue3_i(a,b,c) a##b##c
nuclear@0 685 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
nuclear@0 686 # ifndef PRINTF_INTPTR_MODIFIER
nuclear@0 687 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
nuclear@0 688 # endif
nuclear@0 689 # ifndef PTRDIFF_MAX
nuclear@0 690 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
nuclear@0 691 # endif
nuclear@0 692 # ifndef PTRDIFF_MIN
nuclear@0 693 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
nuclear@0 694 # endif
nuclear@0 695 # ifndef UINTPTR_MAX
nuclear@0 696 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
nuclear@0 697 # endif
nuclear@0 698 # ifndef INTPTR_MAX
nuclear@0 699 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
nuclear@0 700 # endif
nuclear@0 701 # ifndef INTPTR_MIN
nuclear@0 702 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
nuclear@0 703 # endif
nuclear@0 704 # ifndef INTPTR_C
nuclear@0 705 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
nuclear@0 706 # endif
nuclear@0 707 # ifndef UINTPTR_C
nuclear@0 708 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
nuclear@0 709 # endif
nuclear@0 710 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
nuclear@0 711 typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
nuclear@0 712 # else
nuclear@0 713 /* TODO -- This following is likely wrong for some platforms, and does
nuclear@0 714 nothing for the definition of uintptr_t. */
nuclear@0 715 typedef ptrdiff_t intptr_t;
nuclear@0 716 # endif
nuclear@0 717 # define STDINT_H_UINTPTR_T_DEFINED
nuclear@0 718 #endif
nuclear@0 719
nuclear@0 720 /*
nuclear@0 721 * Assumes sig_atomic_t is signed and we have a 2s complement machine.
nuclear@0 722 */
nuclear@0 723
nuclear@0 724 #ifndef SIG_ATOMIC_MAX
nuclear@0 725 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
nuclear@0 726 #endif
nuclear@0 727
nuclear@0 728 #endif
nuclear@0 729