192 #if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && __WATCOMC__ >= 1250) || (defined(__GNUC__) && __GNUC__ > 2) || (defined(_MSC_VER) && _MSC_VER >= 1600)
196 #if (defined (_STDINT_H_INCLUDED) || defined (_STDINT) || defined (_STDINT_H) || defined (_STDINT_H_)) && !defined (_PSTDINT_H_INCLUDED)
197 #define _PSTDINT_H_INCLUDED
198 # ifndef PRINTF_INT64_MODIFIER
199 # if __WORDSIZE == 64
200 # define PRINTF_INT64_MODIFIER "l"
202 # define PRINTF_INT64_MODIFIER "ll"
205 # ifndef PRINTF_INT32_MODIFIER
206 # if (LONG_MAX == INT32_MAX) && !defined(__GNUC__)
207 # define PRINTF_INT32_MODIFIER "l"
209 # define PRINTF_INT32_MODIFIER ""
212 # ifndef PRINTF_INT16_MODIFIER
213 # define PRINTF_INT16_MODIFIER "h"
215 # ifndef PRINTF_INTMAX_MODIFIER
216 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
218 # ifndef PRINTF_INT64_HEX_WIDTH
219 # define PRINTF_INT64_HEX_WIDTH "16"
221 # ifndef PRINTF_INT32_HEX_WIDTH
222 # define PRINTF_INT32_HEX_WIDTH "8"
224 # ifndef PRINTF_INT16_HEX_WIDTH
225 # define PRINTF_INT16_HEX_WIDTH "4"
227 # ifndef PRINTF_INT8_HEX_WIDTH
228 # define PRINTF_INT8_HEX_WIDTH "2"
230 # ifndef PRINTF_INT64_DEC_WIDTH
231 # define PRINTF_INT64_DEC_WIDTH "20"
233 # ifndef PRINTF_INT32_DEC_WIDTH
234 # define PRINTF_INT32_DEC_WIDTH "10"
236 # ifndef PRINTF_INT16_DEC_WIDTH
237 # define PRINTF_INT16_DEC_WIDTH "5"
239 # ifndef PRINTF_INT8_DEC_WIDTH
240 # define PRINTF_INT8_DEC_WIDTH "3"
242 # ifndef PRINTF_INTMAX_HEX_WIDTH
243 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
245 # ifndef PRINTF_INTMAX_DEC_WIDTH
246 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
254 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
255 # if !defined (INT64_C)
256 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
258 # if !defined (UINT64_C)
259 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
261 # if !defined (INT32_C)
262 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
264 # if !defined (UINT32_C)
265 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
267 # if !defined (INT16_C)
268 # define INT16_C(x) (x)
270 # if !defined (UINT16_C)
271 # define UINT16_C(x) (x)
273 # if !defined (INT8_C)
274 # define INT8_C(x) (x)
276 # if !defined (UINT8_C)
277 # define UINT8_C(x) (x)
279 # if !defined (UINT64_MAX)
280 # define UINT64_MAX 18446744073709551615ULL
282 # if !defined (INT64_MAX)
283 # define INT64_MAX 9223372036854775807LL
285 # if !defined (UINT32_MAX)
286 # define UINT32_MAX 4294967295UL
288 # if !defined (INT32_MAX)
289 # define INT32_MAX 2147483647L
291 # if !defined (INTMAX_MAX)
292 # define INTMAX_MAX INT64_MAX
294 # if !defined (INTMAX_MIN)
295 # define INTMAX_MIN INT64_MIN
300 #ifndef _PSTDINT_H_INCLUDED
301 #define _PSTDINT_H_INCLUDED
304 # define SIZE_MAX (~(size_t)0)
314 # define UINT8_MAX 0xff
317 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
318 typedef unsigned char uint8_t;
319 # define UINT8_C(v) ((uint8_t) v)
321 # error "Platform not supported"
326 # define INT8_MAX 0x7f
329 # define INT8_MIN INT8_C(0x80)
332 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
333 typedef signed char int8_t;
334 # define INT8_C(v) ((int8_t) v)
336 # error "Platform not supported"
341 # define UINT16_MAX 0xffff
344 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
345 typedef unsigned int uint16_t;
346 # ifndef PRINTF_INT16_MODIFIER
347 # define PRINTF_INT16_MODIFIER ""
349 # define UINT16_C(v) ((uint16_t) (v))
350 #elif (USHRT_MAX == UINT16_MAX)
351 typedef unsigned short uint16_t;
352 # define UINT16_C(v) ((uint16_t) (v))
353 # ifndef PRINTF_INT16_MODIFIER
354 # define PRINTF_INT16_MODIFIER "h"
357 #error "Platform not supported"
362 # define INT16_MAX 0x7fff
365 # define INT16_MIN INT16_C(0x8000)
368 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
369 typedef signed int int16_t;
370 # define INT16_C(v) ((int16_t) (v))
371 # ifndef PRINTF_INT16_MODIFIER
372 # define PRINTF_INT16_MODIFIER ""
374 #elif (SHRT_MAX == INT16_MAX)
375 typedef signed short int16_t;
376 # define INT16_C(v) ((int16_t) (v))
377 # ifndef PRINTF_INT16_MODIFIER
378 # define PRINTF_INT16_MODIFIER "h"
381 #error "Platform not supported"
386 # define UINT32_MAX (0xffffffffUL)
389 #if (UINT_MAX == UINT32_MAX) && !defined (S_SPLINT_S)
390 typedef unsigned int uint32_t;
391 # ifndef PRINTF_INT32_MODIFIER
392 # define PRINTF_INT32_MODIFIER ""
394 # define UINT32_C(v) v ## U
395 #elif (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
396 typedef unsigned long uint32_t;
397 # define UINT32_C(v) v ## UL
398 # ifndef PRINTF_INT32_MODIFIER
399 # define PRINTF_INT32_MODIFIER "l"
401 #elif (USHRT_MAX == UINT32_MAX)
402 typedef unsigned short uint32_t;
403 # define UINT32_C(v) ((unsigned short) (v))
404 # ifndef PRINTF_INT32_MODIFIER
405 # define PRINTF_INT32_MODIFIER ""
408 #error "Platform not supported"
413 # define INT32_MAX (0x7fffffffL)
416 # define INT32_MIN INT32_C(0x80000000)
419 #if (INT_MAX == INT32_MAX) && defined (__GNUC__) && (__GNUC__ > 3)
420 typedef signed int int32_t;
421 # define INT32_C(v) v
422 # ifndef PRINTF_INT32_MODIFIER
423 # define PRINTF_INT32_MODIFIER ""
425 #elif (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
426 typedef signed long int32_t;
427 # define INT32_C(v) v ## L
428 # ifndef PRINTF_INT32_MODIFIER
429 # define PRINTF_INT32_MODIFIER "l"
431 #elif (INT_MAX == INT32_MAX)
432 typedef signed int int32_t;
433 # define INT32_C(v) v
434 # ifndef PRINTF_INT32_MODIFIER
435 # define PRINTF_INT32_MODIFIER ""
437 #elif (SHRT_MAX == INT32_MAX)
438 typedef signed short int32_t;
439 # define INT32_C(v) ((short) (v))
440 # ifndef PRINTF_INT32_MODIFIER
441 # define PRINTF_INT32_MODIFIER ""
444 #error "Platform not supported"
455 #undef stdint_int64_defined
456 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
457 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
458 # define stdint_int64_defined
459 typedef long long int64_t;
460 typedef unsigned long long uint64_t;
461 # define UINT64_C(v) v ## ULL
462 # define INT64_C(v) v ## LL
463 # ifndef PRINTF_INT64_MODIFIER
464 # define PRINTF_INT64_MODIFIER "ll"
469 #if !defined (stdint_int64_defined)
470 # if defined(__GNUC__) && __WORDSIZE == 64
471 # define stdint_int64_defined
472 __extension__
typedef long int64_t;
473 __extension__
typedef unsigned long uint64_t;
474 # define UINT64_C(v) v ## UL
475 # define INT64_C(v) v ## L
476 # ifndef PRINTF_INT64_MODIFIER
477 # define PRINTF_INT64_MODIFIER "l"
479 #elif defined(__GNUC__)
480 # define stdint_int64_defined
481 __extension__
typedef long long int64_t;
482 __extension__
typedef unsigned long long uint64_t;
483 # define UINT64_C(v) v ## ULL
484 # define INT64_C(v) v ## LL
485 # ifndef PRINTF_INT64_MODIFIER
486 # define PRINTF_INT64_MODIFIER "ll"
488 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
489 # define stdint_int64_defined
490 typedef long long int64_t;
491 typedef unsigned long long uint64_t;
492 # define UINT64_C(v) v ## ULL
493 # define INT64_C(v) v ## LL
494 # ifndef PRINTF_INT64_MODIFIER
495 # define PRINTF_INT64_MODIFIER "ll"
497 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
498 # define stdint_int64_defined
499 typedef __int64 int64_t;
500 typedef unsigned __int64 uint64_t;
501 # define UINT64_C(v) v ## UI64
502 # define INT64_C(v) v ## I64
503 # ifndef PRINTF_INT64_MODIFIER
504 # define PRINTF_INT64_MODIFIER "I64"
509 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
510 # define LONG_LONG_MAX INT64_C (9223372036854775807)
512 #ifndef ULONG_LONG_MAX
513 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
516 #if !defined (INT64_MAX) && defined (INT64_C)
517 # define INT64_MAX INT64_C (9223372036854775807)
519 #if !defined (INT64_MIN) && defined (INT64_C)
520 # define INT64_MIN INT64_C (-9223372036854775808)
522 #if !defined (UINT64_MAX) && defined (INT64_C)
523 # define UINT64_MAX UINT64_C (18446744073709551615)
530 #ifndef PRINTF_INT64_HEX_WIDTH
531 # define PRINTF_INT64_HEX_WIDTH "16"
533 #ifndef PRINTF_INT32_HEX_WIDTH
534 # define PRINTF_INT32_HEX_WIDTH "8"
536 #ifndef PRINTF_INT16_HEX_WIDTH
537 # define PRINTF_INT16_HEX_WIDTH "4"
539 #ifndef PRINTF_INT8_HEX_WIDTH
540 # define PRINTF_INT8_HEX_WIDTH "2"
543 #ifndef PRINTF_INT64_DEC_WIDTH
544 # define PRINTF_INT64_DEC_WIDTH "20"
546 #ifndef PRINTF_INT32_DEC_WIDTH
547 # define PRINTF_INT32_DEC_WIDTH "10"
549 #ifndef PRINTF_INT16_DEC_WIDTH
550 # define PRINTF_INT16_DEC_WIDTH "5"
552 #ifndef PRINTF_INT8_DEC_WIDTH
553 # define PRINTF_INT8_DEC_WIDTH "3"
562 #ifdef stdint_int64_defined
565 # define INTMAX_MAX INT64_MAX
566 # define INTMAX_MIN INT64_MIN
567 # define UINTMAX_MAX UINT64_MAX
568 # define UINTMAX_C(v) UINT64_C(v)
569 # define INTMAX_C(v) INT64_C(v)
570 # ifndef PRINTF_INTMAX_MODIFIER
571 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
573 # ifndef PRINTF_INTMAX_HEX_WIDTH
574 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
576 # ifndef PRINTF_INTMAX_DEC_WIDTH
577 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
582 # define INTMAX_MAX INT32_MAX
583 # define UINTMAX_MAX UINT32_MAX
584 # define UINTMAX_C(v) UINT32_C(v)
585 # define INTMAX_C(v) INT32_C(v)
586 # ifndef PRINTF_INTMAX_MODIFIER
587 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
589 # ifndef PRINTF_INTMAX_HEX_WIDTH
590 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
592 # ifndef PRINTF_INTMAX_DEC_WIDTH
593 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
604 #ifndef stdint_least_defined
611 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
612 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
613 # define UINT_LEAST8_MAX UINT8_MAX
614 # define INT_LEAST8_MAX INT8_MAX
615 # define UINT_LEAST16_MAX UINT16_MAX
616 # define INT_LEAST16_MAX INT16_MAX
617 # define UINT_LEAST32_MAX UINT32_MAX
618 # define INT_LEAST32_MAX INT32_MAX
619 # define INT_LEAST8_MIN INT8_MIN
620 # define INT_LEAST16_MIN INT16_MIN
621 # define INT_LEAST32_MIN INT32_MIN
622 # ifdef stdint_int64_defined
623 typedef int64_t int_least64_t;
624 typedef uint64_t uint_least64_t;
625 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
626 # define UINT_LEAST64_MAX UINT64_MAX
627 # define INT_LEAST64_MAX INT64_MAX
628 # define INT_LEAST64_MIN INT64_MIN
631 #undef stdint_least_defined
653 #ifndef uint_fast16_t
659 #ifndef uint_fast32_t
662 #define UINT_FAST8_MAX UINT_LEAST8_MAX
663 #define INT_FAST8_MAX INT_LEAST8_MAX
664 #define UINT_FAST16_MAX UINT_LEAST16_MAX
665 #define INT_FAST16_MAX INT_LEAST16_MAX
666 #define UINT_FAST32_MAX UINT_LEAST32_MAX
667 #define INT_FAST32_MAX INT_LEAST32_MAX
668 #define INT_FAST8_MIN INT_LEAST8_MIN
669 #define INT_FAST16_MIN INT_LEAST16_MIN
670 #define INT_FAST32_MIN INT_LEAST32_MIN
671 #ifdef stdint_int64_defined
672 typedef int_least64_t int_fast64_t;
673 typedef uint_least64_t uint_fast64_t;
674 # define UINT_FAST64_MAX UINT_LEAST64_MAX
675 # define INT_FAST64_MAX INT_LEAST64_MAX
676 # define INT_FAST64_MIN INT_LEAST64_MIN
679 #undef stdint_int64_defined
686 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
692 # define WCHAR_MAX ((wchar_t)-1)
701 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
702 # define STDINT_H_UINTPTR_T_DEFINED
705 #ifndef STDINT_H_UINTPTR_T_DEFINED
706 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
707 # define stdint_intptr_bits 64
708 # elif defined (__WATCOMC__) || defined (__TURBOC__)
709 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
710 # define stdint_intptr_bits 16
712 # define stdint_intptr_bits 32
714 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
715 # define stdint_intptr_bits 32
716 # elif defined (__INTEL_COMPILER)
720 # ifdef stdint_intptr_bits
721 # define stdint_intptr_glue3_i(a,b,c) a##b##c
722 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
723 # ifndef PRINTF_INTPTR_MODIFIER
724 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
727 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
730 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
733 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
736 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
739 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
742 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
745 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
747 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
748 typedef stdint_intptr_glue3(
int,stdint_intptr_bits,_t)
intptr_t;
754 # define STDINT_H_UINTPTR_T_DEFINED
761 #ifndef SIG_ATOMIC_MAX
762 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
767 #ifndef XSENS_MONOLITHIC
769 #if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
780 #define glue3_aux(x,y,z) x ## y ## z
781 #define glue3(x,y,z) glue3_aux(x,y,z)
783 #define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
784 #define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
786 #define DECL(us,bits) glue3(DECL,us,) (bits)
788 #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)
803 char str0[256], str1[256];
805 sprintf (str0,
"%d %x\n", 0, ~0);
807 sprintf (str1,
"%d %x\n", i8, ~0);
808 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i8 : %s\n", str1);
809 sprintf (str1,
"%u %x\n", u8, ~0);
810 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u8 : %s\n", str1);
811 sprintf (str1,
"%d %x\n", i16, ~0);
812 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i16 : %s\n", str1);
813 sprintf (str1,
"%u %x\n", u16, ~0);
814 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u16 : %s\n", str1);
815 sprintf (str1,
"%" PRINTF_INT32_MODIFIER
"d %x\n", i32, ~0);
816 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i32 : %s\n", str1);
817 sprintf (str1,
"%" PRINTF_INT32_MODIFIER
"u %x\n", u32, ~0);
818 if (0 != strcmp (str0, str1)) printf (
"Something wrong with u32 : %s\n", str1);
820 sprintf (str1,
"%" PRINTF_INT64_MODIFIER
"d %x\n", i64, ~0);
821 if (0 != strcmp (str0, str1)) printf (
"Something wrong with i64 : %s\n", str1);
824 if (0 != strcmp (str0, str1)) printf (
"Something wrong with imax : %s\n", str1);
826 if (0 != strcmp (str0, str1)) printf (
"Something wrong with umax : %s\n", str1);
839 #endif // #ifndef XSENS_MONOLITHIC
#define INTMAX_C(v)
Definition: pstdint.h:585
uint16_t uint_least16_t
Definition: pstdint.h:608
int_least32_t int_fast32_t
Definition: pstdint.h:657
int32_t int_least32_t
Definition: pstdint.h:609
uint8_t uint_least8_t
Definition: pstdint.h:606
uint_least32_t uint_fast32_t
Definition: pstdint.h:660
ptrdiff_t intptr_t
Definition: pstdint.h:752
int_least8_t int_fast8_t
Definition: pstdint.h:645
#define PRINTF_INTMAX_MODIFIER
Definition: pstdint.h:587
int32_t intmax_t
Definition: pstdint.h:580
int8_t int_least8_t
Definition: pstdint.h:605
int main(int argc, char *argv[])
Definition: CMakeCCompilerId.c:377
uint32_t uintmax_t
Definition: pstdint.h:581
uint_least16_t uint_fast16_t
Definition: pstdint.h:654
uint_least8_t uint_fast8_t
Definition: pstdint.h:648
uint32_t uint_least32_t
Definition: pstdint.h:610
int16_t int_least16_t
Definition: pstdint.h:607
#define UINTMAX_C(v)
Definition: pstdint.h:584
int_least16_t int_fast16_t
Definition: pstdint.h:651