184 #ifndef _PSTDINT_H_INCLUDED 193 #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && __WATCOMC__ >= 1250) || (defined(__GNUC__) && __GNUC__ > 2) || (defined(_MSC_VER) && _MSC_VER >= 1600) || defined(IAR_ARM_CM3) || (defined(__ICCARM__) && __ICCARM__) || (defined(_ADI_COMPILER) && _ADI_COMPILER) || (defined(__ICC8051__) && __ICC8051__) 197 #if (defined (_STDINT_H_INCLUDED) || defined (_STDINT) || defined (_STDINT_H) || defined (_STDINT_H_) || defined (BOOST_CSTDINT_HPP)) && !defined (_PSTDINT_H_INCLUDED) 198 #define _PSTDINT_H_INCLUDED 199 # ifndef PRINTF_INT64_MODIFIER 200 # if (__WORDSIZE == 64) && !defined(__APPLE__) //lint !e553 __WORDSIZE should always be defined at this point 201 # define PRINTF_INT64_MODIFIER "l" 203 # define PRINTF_INT64_MODIFIER "ll" 206 # ifndef PRINTF_INT32_MODIFIER 208 # define PRINTF_INT32_MODIFIER "" 210 # ifndef PRINTF_INT16_MODIFIER 211 # define PRINTF_INT16_MODIFIER "h" 213 # ifndef PRINTF_INTMAX_MODIFIER 214 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER 216 # ifndef PRINTF_INT64_HEX_WIDTH 217 # define PRINTF_INT64_HEX_WIDTH "16" 219 # ifndef PRINTF_INT32_HEX_WIDTH 220 # define PRINTF_INT32_HEX_WIDTH "8" 222 # ifndef PRINTF_INT16_HEX_WIDTH 223 # define PRINTF_INT16_HEX_WIDTH "4" 225 # ifndef PRINTF_INT8_HEX_WIDTH 226 # define PRINTF_INT8_HEX_WIDTH "2" 228 # ifndef PRINTF_INT64_DEC_WIDTH 229 # define PRINTF_INT64_DEC_WIDTH "20" 231 # ifndef PRINTF_INT32_DEC_WIDTH 232 # define PRINTF_INT32_DEC_WIDTH "10" 234 # ifndef PRINTF_INT16_DEC_WIDTH 235 # define PRINTF_INT16_DEC_WIDTH "5" 237 # ifndef PRINTF_INT8_DEC_WIDTH 238 # define PRINTF_INT8_DEC_WIDTH "3" 240 # ifndef PRINTF_INTMAX_HEX_WIDTH 241 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH 243 # ifndef PRINTF_INTMAX_DEC_WIDTH 244 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH 252 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250 253 # if !defined (INT64_C) 254 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) 256 # if !defined (UINT64_C) 257 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) 259 # if !defined (INT32_C) 260 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) 262 # if !defined (UINT32_C) 263 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) 265 # if !defined (INT16_C) 266 # define INT16_C(x) (x) 268 # if !defined (UINT16_C) 269 # define UINT16_C(x) (x) 271 # if !defined (INT8_C) 272 # define INT8_C(x) (x) 274 # if !defined (UINT8_C) 275 # define UINT8_C(x) (x) 277 # if !defined (UINT64_MAX) 278 # define UINT64_MAX 18446744073709551615ULL 280 # if !defined (INT64_MAX) 281 # define INT64_MAX 9223372036854775807LL 283 # if !defined (UINT32_MAX) 284 # define UINT32_MAX 4294967295UL 286 # if !defined (INT32_MAX) 287 # define INT32_MAX 2147483647L 289 # if !defined (INTMAX_MAX) 290 # define INTMAX_MAX INT64_MAX 292 # if !defined (INTMAX_MIN) 293 # define INTMAX_MIN INT64_MIN 300 #if (defined(_ADI_COMPILER) && _ADI_COMPILER) 302 typedef signed char int8_t;
313 #endif //(defined(_ADI_COMPILER) && _ADI_COMPILER) 317 #ifndef _PSTDINT_H_INCLUDED 318 #define _PSTDINT_H_INCLUDED 322 # define SIZE_MAX (~0) 324 # define SIZE_MAX (~(size_t)0) 335 # define UINT8_MAX 0xff 338 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) 340 # define UINT8_C(v) ((uint8_t) v) 342 # error "Platform not supported" 347 # define INT8_MAX 0x7f 350 # define INT8_MIN INT8_C(0x80) 353 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) 354 typedef signed char int8_t;
355 # define INT8_C(v) ((int8_t) v) 357 # error "Platform not supported" 362 # define UINT16_MAX 0xffff 365 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) 367 # ifndef PRINTF_INT16_MODIFIER 368 # define PRINTF_INT16_MODIFIER "" 370 # define UINT16_C(v) ((uint16_t) (v)) 371 #elif (USHRT_MAX == UINT16_MAX) 373 # define UINT16_C(v) ((uint16_t) (v)) 374 # ifndef PRINTF_INT16_MODIFIER 375 # define PRINTF_INT16_MODIFIER "h" 378 #error "Platform not supported" 383 # define INT16_MAX 0x7fff 386 # define INT16_MIN INT16_C(0x8000) 389 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) 391 # define INT16_C(v) ((int16_t) (v)) 392 # ifndef PRINTF_INT16_MODIFIER 393 # define PRINTF_INT16_MODIFIER "" 395 #elif (SHRT_MAX == INT16_MAX) 397 # define INT16_C(v) ((int16_t) (v)) 398 # ifndef PRINTF_INT16_MODIFIER 399 # define PRINTF_INT16_MODIFIER "h" 402 #error "Platform not supported" 407 # define UINT32_MAX (0xffffffffUL) 410 #if (SIZE_MAX == UINT32_MAX) && !defined (S_SPLINT_S) && !defined(_lint) 412 # ifndef PRINTF_INT32_MODIFIER 413 # define PRINTF_INT32_MODIFIER "" 415 # define UINT32_C(v) v ## U 416 #elif (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) 418 # define UINT32_C(v) v ## UL 419 # ifndef PRINTF_INT32_MODIFIER 420 # define PRINTF_INT32_MODIFIER "l" 422 #elif (USHRT_MAX == UINT32_MAX) 424 # define UINT32_C(v) ((unsigned short) (v)) 425 # ifndef PRINTF_INT32_MODIFIER 426 # define PRINTF_INT32_MODIFIER "" 429 #error "Platform not supported" 434 # define INT32_MAX (0x7fffffffL) 437 # define INT32_MIN INT32_C(0x80000000) 440 #if (SIZE_MAX/2 == INT32_MAX) && defined (__GNUC__) && (__GNUC__ > 3) 442 # define INT32_C(v) v 443 # ifndef PRINTF_INT32_MODIFIER 444 # define PRINTF_INT32_MODIFIER "" 446 #elif (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) 448 # define INT32_C(v) v ## L 449 # ifndef PRINTF_INT32_MODIFIER 450 # define PRINTF_INT32_MODIFIER "l" 452 #elif (SIZE_MAX/2 == INT32_MAX) 454 # define INT32_C(v) v 455 # ifndef PRINTF_INT32_MODIFIER 456 # define PRINTF_INT32_MODIFIER "" 458 #elif (SHRT_MAX == INT32_MAX) 460 # define INT32_C(v) ((short) (v)) 461 # ifndef PRINTF_INT32_MODIFIER 462 # define PRINTF_INT32_MODIFIER "" 465 #error "Platform not supported" 476 #undef stdint_int64_defined 477 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) 478 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S) 479 # define stdint_int64_defined 481 typedef unsigned long long uint64_t;
482 # define UINT64_C(v) v ## ULL 483 # define INT64_C(v) v ## LL 484 # ifndef PRINTF_INT64_MODIFIER 485 # define PRINTF_INT64_MODIFIER "ll" 490 #if !defined (stdint_int64_defined) 491 # if defined(__GNUC__) && __WORDSIZE == 64 492 # define stdint_int64_defined 493 __extension__
typedef long int64_t;
494 __extension__
typedef unsigned long uint64_t;
495 # define UINT64_C(v) v ## UL 496 # define INT64_C(v) v ## L 497 # ifndef PRINTF_INT64_MODIFIER 498 # define PRINTF_INT64_MODIFIER "l" 500 #elif defined(__GNUC__) 501 # define stdint_int64_defined 502 __extension__
typedef long long int64_t;
503 __extension__
typedef unsigned long long uint64_t;
504 # define UINT64_C(v) v ## ULL 505 # define INT64_C(v) v ## LL 506 # ifndef PRINTF_INT64_MODIFIER 507 # define PRINTF_INT64_MODIFIER "ll" 509 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) 510 # define stdint_int64_defined 512 typedef unsigned long long uint64_t;
513 # define UINT64_C(v) v ## ULL 514 # define INT64_C(v) v ## LL 515 # ifndef PRINTF_INT64_MODIFIER 516 # define PRINTF_INT64_MODIFIER "ll" 518 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) 519 # define stdint_int64_defined 522 # define UINT64_C(v) v ## UI64 523 # define INT64_C(v) v ## I64 524 # ifndef PRINTF_INT64_MODIFIER 525 # define PRINTF_INT64_MODIFIER "I64" 530 #if !defined (LONG_LONG_MAX) && defined (INT64_C) 531 # define LONG_LONG_MAX INT64_C (9223372036854775807LL) 533 #ifndef ULONG_LONG_MAX 534 # define ULONG_LONG_MAX UINT64_C (18446744073709551615ULL) 537 #if !defined (INT64_MAX) && defined (INT64_C) 538 # define INT64_MAX INT64_C (9223372036854775807LL) 540 #if !defined (INT64_MIN) && defined (INT64_C) 542 # define INT64_MIN INT64_C (-9223372036854775808LL) 544 #if !defined (UINT64_MAX) && defined (INT64_C) 545 # define UINT64_MAX UINT64_C (18446744073709551615ULL) 552 #ifndef PRINTF_INT64_HEX_WIDTH 553 # define PRINTF_INT64_HEX_WIDTH "16" 555 #ifndef PRINTF_INT32_HEX_WIDTH 556 # define PRINTF_INT32_HEX_WIDTH "8" 558 #ifndef PRINTF_INT16_HEX_WIDTH 559 # define PRINTF_INT16_HEX_WIDTH "4" 561 #ifndef PRINTF_INT8_HEX_WIDTH 562 # define PRINTF_INT8_HEX_WIDTH "2" 565 #ifndef PRINTF_INT64_DEC_WIDTH 566 # define PRINTF_INT64_DEC_WIDTH "20" 568 #ifndef PRINTF_INT32_DEC_WIDTH 569 # define PRINTF_INT32_DEC_WIDTH "10" 571 #ifndef PRINTF_INT16_DEC_WIDTH 572 # define PRINTF_INT16_DEC_WIDTH "5" 574 #ifndef PRINTF_INT8_DEC_WIDTH 575 # define PRINTF_INT8_DEC_WIDTH "3" 584 #ifdef stdint_int64_defined 587 # define INTMAX_MAX INT64_MAX 588 # define INTMAX_MIN INT64_MIN 589 # define UINTMAX_MAX UINT64_MAX 590 # define UINTMAX_C(v) UINT64_C(v) 591 # define INTMAX_C(v) INT64_C(v) 592 # ifndef PRINTF_INTMAX_MODIFIER 593 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER 595 # ifndef PRINTF_INTMAX_HEX_WIDTH 596 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH 598 # ifndef PRINTF_INTMAX_DEC_WIDTH 599 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH 604 # define INTMAX_MAX INT32_MAX 605 # define UINTMAX_MAX UINT32_MAX 606 # define UINTMAX_C(v) UINT32_C(v) 607 # define INTMAX_C(v) INT32_C(v) 608 # ifndef PRINTF_INTMAX_MODIFIER 609 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER 611 # ifndef PRINTF_INTMAX_HEX_WIDTH 612 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH 614 # ifndef PRINTF_INTMAX_DEC_WIDTH 615 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH 626 #ifndef stdint_least_defined 633 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER 634 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER 635 # define UINT_LEAST8_MAX UINT8_MAX 636 # define INT_LEAST8_MAX INT8_MAX 637 # define UINT_LEAST16_MAX UINT16_MAX 638 # define INT_LEAST16_MAX INT16_MAX 639 # define UINT_LEAST32_MAX UINT32_MAX 640 # define INT_LEAST32_MAX INT32_MAX 641 # define INT_LEAST8_MIN INT8_MIN 642 # define INT_LEAST16_MIN INT16_MIN 643 # define INT_LEAST32_MIN INT32_MIN 644 # ifdef stdint_int64_defined 647 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER 648 # define UINT_LEAST64_MAX UINT64_MAX 649 # define INT_LEAST64_MAX INT64_MAX 650 # define INT_LEAST64_MIN INT64_MIN 653 #undef stdint_least_defined 675 #ifndef uint_fast16_t 681 #ifndef uint_fast32_t 684 #define UINT_FAST8_MAX UINT_LEAST8_MAX 685 #define INT_FAST8_MAX INT_LEAST8_MAX 686 #define UINT_FAST16_MAX UINT_LEAST16_MAX 687 #define INT_FAST16_MAX INT_LEAST16_MAX 688 #define UINT_FAST32_MAX UINT_LEAST32_MAX 689 #define INT_FAST32_MAX INT_LEAST32_MAX 690 #define INT_FAST8_MIN INT_LEAST8_MIN 691 #define INT_FAST16_MIN INT_LEAST16_MIN 692 #define INT_FAST32_MIN INT_LEAST32_MIN 693 #ifdef stdint_int64_defined 694 typedef int_least64_t int_fast64_t;
695 typedef uint_least64_t uint_fast64_t;
696 # define UINT_FAST64_MAX UINT_LEAST64_MAX 697 # define INT_FAST64_MAX INT_LEAST64_MAX 698 # define INT_FAST64_MIN INT_LEAST64_MIN 706 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) 712 # define WCHAR_MAX ((wchar_t)-1) 721 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) 722 # define STDINT_H_UINTPTR_T_DEFINED 725 #ifndef STDINT_H_UINTPTR_T_DEFINED 726 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) 727 # define stdint_intptr_bits 64 728 # elif defined (__WATCOMC__) || defined (__TURBOC__) 729 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) 730 # define stdint_intptr_bits 16 732 # define stdint_intptr_bits 32 734 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32) 735 # define stdint_intptr_bits 32 736 # elif defined (__INTEL_COMPILER) 740 # ifdef stdint_intptr_bits 741 # define stdint_intptr_glue3_i(a,b,c) a##b##c 742 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) 743 # ifndef PRINTF_INTPTR_MODIFIER 744 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) 747 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) 750 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) 753 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) 756 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) 759 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) 762 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) 765 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) 774 # define STDINT_H_UINTPTR_T_DEFINED 781 #ifndef SIG_ATOMIC_MAX 782 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) 787 #if defined (__TEST_PSTDINT_FOR_CORRECTNESS) 798 #define glue3_aux(x,y,z) x ## y ## z 799 #define glue3(x,y,z) glue3_aux(x,y,z) 801 #define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0); 802 #define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0); 804 #define DECL(us,bits) glue3(DECL,us,) (bits) 806 #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) 821 char str0[256], str1[256];
823 sprintf (str0,
"%d %x\n", 0, ~0);
825 sprintf (str1,
"%d %x\n", i8, ~0);
826 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i8 : %s\n", str1);
827 sprintf (str1,
"%u %x\n", u8, ~0);
828 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u8 : %s\n", str1);
829 sprintf (str1,
"%d %x\n", i16, ~0);
830 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i16 : %s\n", str1);
831 sprintf (str1,
"%u %x\n", u16, ~0);
832 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u16 : %s\n", str1);
834 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i32 : %s\n", str1);
836 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u32 : %s\n", str1);
838 sprintf (str1,
"%" PRINTF_INT64_MODIFIER
"d %x\n", i64, ~0);
839 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i64 : %s\n", str1);
842 if (0 != strcmp (str0, str1)) printf (
"Something wrong with imax : %s\n", str1);
844 if (0 != strcmp (str0, str1)) printf (
"Something wrong with umax : %s\n", str1);
858 #if defined(_STDINT) && defined(_MSC_VER) 859 #define stdint_int64_defined
unsigned __int16 uint16_t
#define PRINTF_INTMAX_MODIFIER
#define PRINTF_INT32_MODIFIER
int_least16_t int_fast16_t
uint_least8_t uint_fast8_t
unsigned __int64 uint64_t
int_least32_t int_fast32_t
uint_least16_t uint_fast16_t
#define stdint_intptr_glue3(a, b, c)
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
uint_least32_t uint_fast32_t
unsigned __int32 uint32_t
#define stdint_intptr_bits