196 #if ((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)
198 #define _PSTDINT_H_INCLUDED
199 # if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__))
200 # ifndef PRINTF_INT64_MODIFIER
201 # define PRINTF_INT64_MODIFIER "l"
203 # ifndef PRINTF_INT32_MODIFIER
204 # define PRINTF_INT32_MODIFIER ""
207 # ifndef PRINTF_INT64_MODIFIER
208 # define PRINTF_INT64_MODIFIER "ll"
210 # ifndef PRINTF_INT32_MODIFIER
211 # define PRINTF_INT32_MODIFIER "l"
214 # ifndef PRINTF_INT16_MODIFIER
215 # define PRINTF_INT16_MODIFIER "h"
217 # ifndef PRINTF_INTMAX_MODIFIER
218 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
220 # ifndef PRINTF_INT64_HEX_WIDTH
221 # define PRINTF_INT64_HEX_WIDTH "16"
223 # ifndef PRINTF_INT32_HEX_WIDTH
224 # define PRINTF_INT32_HEX_WIDTH "8"
226 # ifndef PRINTF_INT16_HEX_WIDTH
227 # define PRINTF_INT16_HEX_WIDTH "4"
229 # ifndef PRINTF_INT8_HEX_WIDTH
230 # define PRINTF_INT8_HEX_WIDTH "2"
232 # ifndef PRINTF_INT64_DEC_WIDTH
233 # define PRINTF_INT64_DEC_WIDTH "20"
235 # ifndef PRINTF_INT32_DEC_WIDTH
236 # define PRINTF_INT32_DEC_WIDTH "10"
238 # ifndef PRINTF_INT16_DEC_WIDTH
239 # define PRINTF_INT16_DEC_WIDTH "5"
241 # ifndef PRINTF_INT8_DEC_WIDTH
242 # define PRINTF_INT8_DEC_WIDTH "3"
244 # ifndef PRINTF_INTMAX_HEX_WIDTH
245 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
247 # ifndef PRINTF_INTMAX_DEC_WIDTH
248 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
256 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
257 # if !defined (INT64_C)
258 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
260 # if !defined (UINT64_C)
261 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
263 # if !defined (INT32_C)
264 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
266 # if !defined (UINT32_C)
267 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
269 # if !defined (INT16_C)
270 # define INT16_C(x) (x)
272 # if !defined (UINT16_C)
273 # define UINT16_C(x) (x)
275 # if !defined (INT8_C)
276 # define INT8_C(x) (x)
278 # if !defined (UINT8_C)
279 # define UINT8_C(x) (x)
281 # if !defined (UINT64_MAX)
282 # define UINT64_MAX 18446744073709551615ULL
284 # if !defined (INT64_MAX)
285 # define INT64_MAX 9223372036854775807LL
287 # if !defined (UINT32_MAX)
288 # define UINT32_MAX 4294967295UL
290 # if !defined (INT32_MAX)
291 # define INT32_MAX 2147483647L
293 # if !defined (INTMAX_MAX)
294 # define INTMAX_MAX INT64_MAX
296 # if !defined (INTMAX_MIN)
297 # define INTMAX_MIN INT64_MIN
302 #ifndef _PSTDINT_H_INCLUDED
303 #define _PSTDINT_H_INCLUDED
306 # define SIZE_MAX (~(size_t)0)
316 # define UINT8_MAX 0xff
318 #if !defined(uint8_t) && !defined(_UINT8_T)
319 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
320 typedef unsigned char uint8_t;
321 # define UINT8_C(v) ((uint8_t) v)
323 # error "Platform not supported"
328 # define INT8_MAX 0x7f
331 # define INT8_MIN INT8_C(0x80)
333 #if !defined(int8_t) && !defined(_INT8_T)
334 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
335 typedef signed char int8_t;
336 # define INT8_C(v) ((int8_t) v)
338 # error "Platform not supported"
343 # define UINT16_MAX 0xffff
345 #if !defined(uint16_t) && !defined(_UINT16_T)
346 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
347 typedef unsigned int uint16_t;
348 # ifndef PRINTF_INT16_MODIFIER
349 # define PRINTF_INT16_MODIFIER ""
351 # define UINT16_C(v) ((uint16_t) (v))
352 #elif (USHRT_MAX == UINT16_MAX)
353 typedef unsigned int16_t uint16_t;
354 # define UINT16_C(v) ((uint16_t) (v))
355 # ifndef PRINTF_INT16_MODIFIER
356 # define PRINTF_INT16_MODIFIER "h"
359 #error "Platform not supported"
364 # define INT16_MAX 0x7fff
367 # define INT16_MIN INT16_C(0x8000)
369 #if !defined(int16_t) && !defined(_INT16_T)
370 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
371 typedef signed int int16_t;
372 # define INT16_C(v) ((int16_t) (v))
373 # ifndef PRINTF_INT16_MODIFIER
374 # define PRINTF_INT16_MODIFIER ""
376 #elif (SHRT_MAX == INT16_MAX)
377 typedef signed int16_t int16_t;
378 # define INT16_C(v) ((int16_t) (v))
379 # ifndef PRINTF_INT16_MODIFIER
380 # define PRINTF_INT16_MODIFIER "h"
383 #error "Platform not supported"
388 # define UINT32_MAX (0xffffffffUL)
390 #if !defined(uint32_t) && !defined(_UINT32_T)
391 #if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
392 typedef unsigned long uint32_t;
393 # define UINT32_C(v) v ## UL
394 # ifndef PRINTF_INT32_MODIFIER
395 # define PRINTF_INT32_MODIFIER "l"
397 #elif (UINT_MAX == UINT32_MAX)
398 typedef unsigned int uint32_t;
399 # ifndef PRINTF_INT32_MODIFIER
400 # define PRINTF_INT32_MODIFIER ""
402 # define UINT32_C(v) v ## U
403 #elif (USHRT_MAX == UINT32_MAX)
404 typedef unsigned int16_t uint32_t;
405 # define UINT32_C(v) ((unsigned int16_t) (v))
406 # ifndef PRINTF_INT32_MODIFIER
407 # define PRINTF_INT32_MODIFIER ""
410 #error "Platform not supported"
415 # define INT32_MAX (0x7fffffffL)
418 # define INT32_MIN INT32_C(0x80000000)
420 #if !defined(int32_t) && !defined(_INT32_T)
421 #if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
422 typedef signed long int32_t;
423 # define INT32_C(v) v ## L
424 # ifndef PRINTF_INT32_MODIFIER
425 # define PRINTF_INT32_MODIFIER "l"
427 #elif (INT_MAX == INT32_MAX)
428 typedef signed int int32_t;
429 # define INT32_C(v) v
430 # ifndef PRINTF_INT32_MODIFIER
431 # define PRINTF_INT32_MODIFIER ""
433 #elif (SHRT_MAX == INT32_MAX)
434 typedef signed int16_t int32_t;
435 # define INT32_C(v) ((int16_t) (v))
436 # ifndef PRINTF_INT32_MODIFIER
437 # define PRINTF_INT32_MODIFIER ""
440 #error "Platform not supported"
451 #undef stdint_int64_defined
452 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
453 # if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
454 # define stdint_int64_defined
455 typedef long long int64_t;
456 typedef unsigned long long uint64_t;
457 # define UINT64_C(v) v ## ULL
458 # define INT64_C(v) v ## LL
459 # ifndef PRINTF_INT64_MODIFIER
460 # define PRINTF_INT64_MODIFIER "ll"
465 #if !defined (stdint_int64_defined)
466 # if defined(__GNUC__)
467 # define stdint_int64_defined
468 __extension__
typedef long long int64_t;
469 __extension__
typedef unsigned long long uint64_t;
470 # define UINT64_C(v) v ## ULL
471 # define INT64_C(v) v ## LL
472 # ifndef PRINTF_INT64_MODIFIER
473 # define PRINTF_INT64_MODIFIER "ll"
475 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
476 # define stdint_int64_defined
477 typedef long long int64_t;
478 typedef unsigned long long uint64_t;
479 # define UINT64_C(v) v ## ULL
480 # define INT64_C(v) v ## LL
481 # ifndef PRINTF_INT64_MODIFIER
482 # define PRINTF_INT64_MODIFIER "ll"
484 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
485 # define stdint_int64_defined
486 typedef __int64 int64_t;
487 typedef unsigned __int64 uint64_t;
488 # define UINT64_C(v) v ## UI64
489 # define INT64_C(v) v ## I64
490 # ifndef PRINTF_INT64_MODIFIER
491 # define PRINTF_INT64_MODIFIER "I64"
496 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
497 # define LONG_LONG_MAX INT64_C (9223372036854775807)
499 #ifndef ULONG_LONG_MAX
500 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
503 #if !defined (INT64_MAX) && defined (INT64_C)
504 # define INT64_MAX INT64_C (9223372036854775807)
506 #if !defined (INT64_MIN) && defined (INT64_C)
507 # define INT64_MIN INT64_C (-9223372036854775808)
509 #if !defined (UINT64_MAX) && defined (INT64_C)
510 # define UINT64_MAX UINT64_C (18446744073709551615)
517 #ifndef PRINTF_INT64_HEX_WIDTH
518 # define PRINTF_INT64_HEX_WIDTH "16"
520 #ifndef PRINTF_INT32_HEX_WIDTH
521 # define PRINTF_INT32_HEX_WIDTH "8"
523 #ifndef PRINTF_INT16_HEX_WIDTH
524 # define PRINTF_INT16_HEX_WIDTH "4"
526 #ifndef PRINTF_INT8_HEX_WIDTH
527 # define PRINTF_INT8_HEX_WIDTH "2"
530 #ifndef PRINTF_INT64_DEC_WIDTH
531 # define PRINTF_INT64_DEC_WIDTH "20"
533 #ifndef PRINTF_INT32_DEC_WIDTH
534 # define PRINTF_INT32_DEC_WIDTH "10"
536 #ifndef PRINTF_INT16_DEC_WIDTH
537 # define PRINTF_INT16_DEC_WIDTH "5"
539 #ifndef PRINTF_INT8_DEC_WIDTH
540 # define PRINTF_INT8_DEC_WIDTH "3"
549 #ifdef stdint_int64_defined
552 # define INTMAX_MAX INT64_MAX
553 # define INTMAX_MIN INT64_MIN
554 # define UINTMAX_MAX UINT64_MAX
555 # define UINTMAX_C(v) UINT64_C(v)
556 # define INTMAX_C(v) INT64_C(v)
557 # ifndef PRINTF_INTMAX_MODIFIER
558 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
560 # ifndef PRINTF_INTMAX_HEX_WIDTH
561 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
563 # ifndef PRINTF_INTMAX_DEC_WIDTH
564 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
569 # define INTMAX_MAX INT32_MAX
570 # define UINTMAX_MAX UINT32_MAX
571 # define UINTMAX_C(v) UINT32_C(v)
572 # define INTMAX_C(v) INT32_C(v)
573 # ifndef PRINTF_INTMAX_MODIFIER
574 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
576 # ifndef PRINTF_INTMAX_HEX_WIDTH
577 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
579 # ifndef PRINTF_INTMAX_DEC_WIDTH
580 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
591 #ifndef stdint_least_defined
598 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
599 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
600 # define UINT_LEAST8_MAX UINT8_MAX
601 # define INT_LEAST8_MAX INT8_MAX
602 # define UINT_LEAST16_MAX UINT16_MAX
603 # define INT_LEAST16_MAX INT16_MAX
604 # define UINT_LEAST32_MAX UINT32_MAX
605 # define INT_LEAST32_MAX INT32_MAX
606 # define INT_LEAST8_MIN INT8_MIN
607 # define INT_LEAST16_MIN INT16_MIN
608 # define INT_LEAST32_MIN INT32_MIN
609 # ifdef stdint_int64_defined
610 typedef int64_t int_least64_t;
611 typedef uint64_t uint_least64_t;
612 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
613 # define UINT_LEAST64_MAX UINT64_MAX
614 # define INT_LEAST64_MAX INT64_MAX
615 # define INT_LEAST64_MIN INT64_MIN
618 #undef stdint_least_defined
637 #define UINT_FAST8_MAX UINT_LEAST8_MAX
638 #define INT_FAST8_MAX INT_LEAST8_MAX
639 #define UINT_FAST16_MAX UINT_LEAST16_MAX
640 #define INT_FAST16_MAX INT_LEAST16_MAX
641 #define UINT_FAST32_MAX UINT_LEAST32_MAX
642 #define INT_FAST32_MAX INT_LEAST32_MAX
643 #define INT_FAST8_MIN INT_LEAST8_MIN
644 #define INT_FAST16_MIN INT_LEAST16_MIN
645 #define INT_FAST32_MIN INT_LEAST32_MIN
646 #ifdef stdint_int64_defined
647 typedef int_least64_t int_fast64_t;
648 typedef uint_least64_t uint_fast64_t;
649 # define UINT_FAST64_MAX UINT_LEAST64_MAX
650 # define INT_FAST64_MAX INT_LEAST64_MAX
651 # define INT_FAST64_MIN INT_LEAST64_MIN
654 #undef stdint_int64_defined
661 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
667 # define WCHAR_MAX ((wchar_t)-1)
676 #if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
677 # define STDINT_H_UINTPTR_T_DEFINED
680 #ifndef STDINT_H_UINTPTR_T_DEFINED
681 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
682 # define stdint_intptr_bits 64
683 # elif defined (__WATCOMC__) || defined (__TURBOC__)
684 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
685 # define stdint_intptr_bits 16
687 # define stdint_intptr_bits 32
689 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
690 # define stdint_intptr_bits 32
691 # elif defined (__INTEL_COMPILER)
697 # ifdef stdint_intptr_bits
698 # define stdint_intptr_glue3_i(a,b,c) a##b##c
699 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
700 # ifndef PRINTF_INTPTR_MODIFIER
701 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
704 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
707 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
710 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
713 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
716 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
719 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
722 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
724 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
725 typedef stdint_intptr_glue3(
int,stdint_intptr_bits,_t)
intptr_t;
731 # define STDINT_H_UINTPTR_T_DEFINED
738 #ifndef SIG_ATOMIC_MAX
739 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
744 #if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
755 #define glue3_aux(x,y,z) x ## y ## z
756 #define glue3(x,y,z) glue3_aux(x,y,z)
758 #define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
759 #define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
761 #define DECL(us,bits) glue3(DECL,us,) (bits)
763 #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)
778 char str0[256], str1[256];
780 sprintf (str0,
"%d %x\n", 0, ~0);
782 sprintf (str1,
"%d %x\n", i8, ~0);
783 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i8 : %s\n", str1);
784 sprintf (str1,
"%u %x\n", u8, ~0);
785 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u8 : %s\n", str1);
786 sprintf (str1,
"%d %x\n", i16, ~0);
787 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i16 : %s\n", str1);
788 sprintf (str1,
"%u %x\n", u16, ~0);
789 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u16 : %s\n", str1);
790 sprintf (str1,
"%" PRINTF_INT32_MODIFIER
"d %x\n", i32, ~0);
791 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i32 : %s\n", str1);
792 sprintf (str1,
"%" PRINTF_INT32_MODIFIER
"u %x\n", u32, ~0);
793 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u32 : %s\n", str1);
795 sprintf (str1,
"%" PRINTF_INT64_MODIFIER
"d %x\n", i64, ~0);
796 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i64 : %s\n", str1);
799 if (0 != strcmp (str0, str1)) printf (
"Something wrong with imax : %s\n", str1);
801 if (0 != strcmp (str0, str1)) printf (
"Something wrong with umax : %s\n", str1);
#define INTMAX_C(v)
Definition: pstdint.h:572
uint16_t uint_least16_t
Definition: pstdint.h:595
int_least32_t int_fast32_t
Definition: pstdint.h:635
int32_t int_least32_t
Definition: pstdint.h:596
uint8_t uint_least8_t
Definition: pstdint.h:593
uint_least32_t uint_fast32_t
Definition: pstdint.h:636
ptrdiff_t intptr_t
Definition: pstdint.h:729
int_least8_t int_fast8_t
Definition: pstdint.h:631
#define PRINTF_INTMAX_MODIFIER
Definition: pstdint.h:574
int32_t intmax_t
Definition: pstdint.h:567
int8_t int_least8_t
Definition: pstdint.h:592
uint32_t uintmax_t
Definition: pstdint.h:568
uint_least16_t uint_fast16_t
Definition: pstdint.h:634
uint_least8_t uint_fast8_t
Definition: pstdint.h:632
uint32_t uint_least32_t
Definition: pstdint.h:597
int main(int argc, const char **argv)
Definition: aggregate.cpp:74
int16_t int_least16_t
Definition: pstdint.h:594
#define UINTMAX_C(v)
Definition: pstdint.h:571
int_least16_t int_fast16_t
Definition: pstdint.h:633