1 /* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
2 Written by Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
23 * ISO C 99 <stdint.h> for platforms that lack it.
24 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
27 /* Get wchar_t, WCHAR_MIN, WCHAR_MAX. */
29 /* BSD/OS 4.2 defines WCHAR_MIN, WCHAR_MAX in <wchar.h>, not <stddef.h>. */
30 #if !(defined(WCHAR_MIN) && defined(WCHAR_MAX)) && @HAVE_WCHAR_H@
34 /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
37 /* Get those types that are already defined in other system include files. */
38 #if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
39 # include <sys/inttypes.h>
41 #if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
42 /* In OpenBSD 3.8, <sys/types.h> includes <machine/types.h>, which defines
43 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
44 <inttypes.h> includes <machine/types.h> and also defines intptr_t and
46 /* BSD/OS 4.2 is similar, but doesn't have <inttypes.h> */
47 /* IRIX 6.5 has <inttypes.h>, and <sys/types.h> defines some of these
49 # include <sys/types.h>
50 # if @HAVE_INTTYPES_H@
51 # include @FULL_PATH_INTTYPES_H@
54 #if defined(__linux__) && @HAVE_SYS_BITYPES_H@
55 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
56 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
57 included by <sys/types.h>. */
58 # include <sys/bitypes.h>
60 #if defined(__sun) && @HAVE_SYS_INTTYPES_H@
61 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
62 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
63 But note that <sys/int_types.h> contains only the type definitions! */
64 # include <sys/inttypes.h>
66 #if (defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@
67 /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
68 UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
69 /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
70 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
71 # include @FULL_PATH_INTTYPES_H@
74 /* Other systems may have an incomplete <stdint.h>. */
75 /* On some versions of IRIX, the SGI C compiler comes with an <stdint.h>,
77 - in c99 mode, <inttypes.h> includes <stdint.h>,
78 - in c89 mode, <stdint.h> spews warnings and defines nothing.
79 <inttypes.h> defines only a subset of the types and macros that
80 <stdint.h> would define in c99 mode.
81 So we rely only on <inttypes.h> (included above). It means that in
82 c89 mode, we shadow the contents of warning-spewing <stdint.h>. */
83 # if !(defined(__sgi) && @HAVE_INTTYPES_H@ && !defined(__c99))
84 # include @FULL_PATH_STDINT_H@
88 /* 7.18.1.1. Exact-width integer types */
90 /* Here we assume a standard architecture where the hardware integer
91 types have 8, 16, 32, optionally 64 bits. */
94 typedef signed char int8_t;
97 typedef unsigned char uint8_t;
98 # define _UINT8_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
102 typedef short int16_t;
105 typedef unsigned short uint16_t;
112 typedef unsigned int uint32_t;
113 # define _UINT32_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
117 # define _STDINT_H_HAVE_INT64 1
119 # if @HAVE_LONG_64BIT@
120 typedef long int64_t;
121 # define _STDINT_H_HAVE_INT64 1
122 # elif @HAVE_LONG_LONG_64BIT@
123 typedef long long int64_t;
124 # define _STDINT_H_HAVE_INT64 1
125 # elif defined _MSC_VER
126 typedef __int64 int64_t;
127 # define _STDINT_H_HAVE_INT64 1
131 # define _STDINT_H_HAVE_UINT64 1
133 # if @HAVE_LONG_64BIT@
134 typedef unsigned long uint64_t;
135 # define _STDINT_H_HAVE_UINT64 1
136 # elif @HAVE_LONG_LONG_64BIT@
137 typedef unsigned long long uint64_t;
138 # define _UINT64_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
139 # define _STDINT_H_HAVE_UINT64 1
140 # elif defined _MSC_VER
141 typedef unsigned __int64 uint64_t;
142 # define _STDINT_H_HAVE_UINT64 1
146 /* 7.18.1.2. Minimum-width integer types */
148 /* Here we assume a standard architecture where the hardware integer
149 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
150 are the same as the corresponding N_t types. */
152 #if !@HAVE_INT_LEAST8_T@
153 typedef int8_t int_least8_t;
155 #if !@HAVE_UINT_LEAST8_T@
156 typedef uint8_t uint_least8_t;
159 #if !@HAVE_INT_LEAST16_T@
160 typedef int16_t int_least16_t;
162 #if !@HAVE_UINT_LEAST16_T@
163 typedef uint16_t uint_least16_t;
166 #if !@HAVE_INT_LEAST32_T@
167 typedef int32_t int_least32_t;
169 #if !@HAVE_UINT_LEAST32_T@
170 typedef uint32_t uint_least32_t;
173 #if !@HAVE_INT_LEAST64_T@ && _STDINT_H_HAVE_INT64
174 typedef int64_t int_least64_t;
176 #if !@HAVE_UINT_LEAST64_T@ && _STDINT_H_HAVE_UINT64
177 typedef uint64_t uint_least64_t;
180 /* 7.18.1.3. Fastest minimum-width integer types */
182 /* Note: Other <stdint.h> substitutes may define these types differently.
183 It is not recommended to use these types in public header files. */
185 /* Here we assume a standard architecture where the hardware integer
186 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
187 are taken from the same list of types. */
189 /* On alpha processors, int32_t variables are slower than int64_t variables,
190 due to the necessary zap instructions. */
192 # define _STDINT_H_INT64_FASTER_THAN_INT32 1
195 #if !@HAVE_INT_FAST8_T@
196 # if _STDINT_H_INT64_FASTER_THAN_INT32
197 typedef int64_t int_fast8_t;
199 typedef int32_t int_fast8_t;
202 #if !@HAVE_UINT_FAST8_T@
203 # if _STDINT_H_INT64_FASTER_THAN_INT32
204 typedef uint64_t uint_fast8_t;
206 typedef uint32_t uint_fast8_t;
210 #if !@HAVE_INT_FAST16_T@
211 # if _STDINT_H_INT64_FASTER_THAN_INT32
212 typedef int64_t int_fast16_t;
214 typedef int32_t int_fast16_t;
217 #if !@HAVE_UINT_FAST16_T@
218 # if _STDINT_H_INT64_FASTER_THAN_INT32
219 typedef uint64_t uint_fast16_t;
221 typedef uint32_t uint_fast16_t;
225 #if !@HAVE_INT_FAST32_T@
226 # if _STDINT_H_INT64_FASTER_THAN_INT32
227 typedef int64_t int_fast32_t;
229 typedef int32_t int_fast32_t;
232 #if !@HAVE_UINT_FAST32_T@
233 # if _STDINT_H_INT64_FASTER_THAN_INT32
234 typedef uint64_t uint_fast32_t;
236 typedef uint32_t uint_fast32_t;
240 #if !@HAVE_INT_FAST64_T@ && _STDINT_H_HAVE_INT64
241 typedef int64_t int_fast64_t;
243 #if !@HAVE_UINT_FAST64_T@ && _STDINT_H_HAVE_UINT64
244 typedef uint64_t uint_fast64_t;
247 /* 7.18.1.4. Integer types capable of holding object pointers */
249 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
250 but this doesn't matter here. */
252 typedef long intptr_t;
254 #if !@HAVE_UINTPTR_T@
255 typedef unsigned long uintptr_t;
258 /* 7.18.1.5. Greatest-width integer types */
260 /* Note: These types are compiler dependent. It may be unwise to use them in
261 public header files. */
264 # ifdef _STDINT_H_HAVE_INT64
265 typedef int64_t intmax_t;
267 typedef int32_t intmax_t;
270 #if !@HAVE_UINTMAX_T@
271 # ifdef _STDINT_H_HAVE_UINT64
272 typedef uint64_t uintmax_t;
274 typedef uint32_t uintmax_t;
278 /* 7.18.2. Limits of specified-width integer types */
280 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
282 /* 7.18.2.1. Limits of exact-width integer types */
284 /* Here we assume a standard architecture where the hardware integer
285 types have 8, 16, 32, optionally 64 bits. */
289 # define INT8_MIN (-1 << (@BITSIZEOF_INT8_T@ - 1))
292 # define INT8_MIN -128
296 # define INT8_MAX (~ (-1 << (@BITSIZEOF_INT8_T@ - 1)))
299 # define INT8_MAX 127
303 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
304 # define UINT8_MAX (((1 << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
306 # define UINT8_MAX (((1U << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
310 # define UINT8_MAX 255
315 # define INT16_MIN (-1 << (@BITSIZEOF_INT16_T@ - 1))
318 # define INT16_MIN -32768
322 # define INT16_MAX (~ (-1 << (@BITSIZEOF_INT16_T@ - 1)))
325 # define INT16_MAX 32767
329 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
330 # define UINT16_MAX (((1 << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
332 # define UINT16_MAX (((1U << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
336 # define UINT16_MAX 65535
341 # define INT32_MIN (-1 << (@BITSIZEOF_INT32_T@ - 1))
344 # define INT32_MIN (~INT32_MAX)
348 # define INT32_MAX (~ (-1 << (@BITSIZEOF_INT32_T@ - 1)))
351 # define INT32_MAX 2147483647
355 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
356 # define UINT32_MAX (((1 << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
358 # define UINT32_MAX (((1U << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
362 # define UINT32_MAX 4294967295U
367 # if @HAVE_LONG_64BIT@
368 # define INT64_MIN (-1L << (@BITSIZEOF_INT64_T@ - 1))
369 # elif @HAVE_LONG_LONG_64BIT@
370 # define INT64_MIN (-1LL << (@BITSIZEOF_INT64_T@ - 1))
371 # elif defined _MSC_VER
372 # define INT64_MIN (-1i64 << (@BITSIZEOF_INT64_T@ - 1))
376 # ifdef _STDINT_H_HAVE_INT64
377 # define INT64_MIN (~INT64_MAX)
382 # if @HAVE_LONG_64BIT@
383 # define INT64_MAX (~ (-1L << (@BITSIZEOF_INT64_T@ - 1)))
384 # elif @HAVE_LONG_LONG_64BIT@
385 # define INT64_MAX (~ (-1LL << (@BITSIZEOF_INT64_T@ - 1)))
386 # elif defined _MSC_VER
387 # define INT64_MAX (~ (-1i64 << (@BITSIZEOF_INT64_T@ - 1)))
391 # ifdef _STDINT_H_HAVE_INT64
392 # if @HAVE_LONG_64BIT@
393 # define INT64_MAX 9223372036854775807L
394 # elif @HAVE_LONG_LONG_64BIT@
395 # define INT64_MAX 9223372036854775807LL
396 # elif defined _MSC_VER
397 # define INT64_MAX 9223372036854775807i64
403 # if @HAVE_LONG_64BIT@
404 # define UINT64_MAX (((1UL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
405 # elif @HAVE_LONG_LONG_64BIT@
406 # define UINT64_MAX (((1ULL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
407 # elif defined _MSC_VER
408 # define UINT64_MAX (((1ui64 << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
412 # ifdef _STDINT_H_HAVE_UINT64
413 # if @HAVE_LONG_64BIT@
414 # define UINT64_MAX 18446744073709551615UL
415 # elif @HAVE_LONG_LONG_64BIT@
416 # define UINT64_MAX 18446744073709551615ULL
417 # elif defined _MSC_VER
418 # define UINT64_MAX 18446744073709551615ui64
423 /* 7.18.2.2. Limits of minimum-width integer types */
425 /* Here we assume a standard architecture where the hardware integer
426 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
427 are the same as the corresponding N_t types. */
429 #if @HAVE_INT_LEAST8_T@
430 # ifndef INT_LEAST8_MIN
431 # define INT_LEAST8_MIN (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1))
434 # define INT_LEAST8_MIN INT8_MIN
436 #if @HAVE_INT_LEAST8_T@
437 # ifndef INT_LEAST8_MAX
438 # define INT_LEAST8_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1)))
441 # define INT_LEAST8_MAX INT8_MAX
443 #if @HAVE_UINT_LEAST8_T@
444 # ifndef UINT_LEAST8_MAX
445 # if @BITSIZEOF_UINT_LEAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
446 # define UINT_LEAST8_MAX (((1 << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
448 # define UINT_LEAST8_MAX (((1U << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
452 # define UINT_LEAST8_MAX UINT8_MAX
455 #if @HAVE_INT_LEAST16_T@
456 # ifndef INT_LEAST16_MIN
457 # define INT_LEAST16_MIN (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1))
460 # define INT_LEAST16_MIN INT16_MIN
462 #if @HAVE_INT_LEAST16_T@
463 # ifndef INT_LEAST16_MAX
464 # define INT_LEAST16_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1)))
467 # define INT_LEAST16_MAX INT16_MAX
469 #if @HAVE_UINT_LEAST16_T@
470 # ifndef UINT_LEAST16_MAX
471 # if @BITSIZEOF_UINT_LEAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
472 # define UINT_LEAST16_MAX (((1 << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
474 # define UINT_LEAST16_MAX (((1U << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
478 # define UINT_LEAST16_MAX UINT16_MAX
481 #if @HAVE_INT_LEAST32_T@
482 # ifndef INT_LEAST32_MIN
483 # define INT_LEAST32_MIN (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1))
486 # define INT_LEAST32_MIN INT32_MIN
488 #if @HAVE_INT_LEAST32_T@
489 # ifndef INT_LEAST32_MAX
490 # define INT_LEAST32_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1)))
493 # define INT_LEAST32_MAX INT32_MAX
495 #if @HAVE_UINT_LEAST32_T@
496 # ifndef UINT_LEAST32_MAX
497 # if @BITSIZEOF_UINT_LEAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
498 # define UINT_LEAST32_MAX (((1 << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
500 # define UINT_LEAST32_MAX (((1U << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
504 # define UINT_LEAST32_MAX UINT32_MAX
507 #if @HAVE_INT_LEAST64_T@
508 # ifndef INT_LEAST64_MIN
509 # if @HAVE_LONG_64BIT@
510 # define INT_LEAST64_MIN (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1))
511 # elif @HAVE_LONG_LONG_64BIT@
512 # define INT_LEAST64_MIN (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1))
513 # elif defined _MSC_VER
514 # define INT_LEAST64_MIN (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1))
518 # ifdef _STDINT_H_HAVE_INT64
519 # define INT_LEAST64_MIN INT64_MIN
522 #if @HAVE_INT_LEAST64_T@
523 # ifndef INT_LEAST64_MAX
524 # if @HAVE_LONG_64BIT@
525 # define INT_LEAST64_MAX (~ (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
526 # elif @HAVE_LONG_LONG_64BIT@
527 # define INT_LEAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
528 # elif defined _MSC_VER
529 # define INT_LEAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
533 # ifdef _STDINT_H_HAVE_INT64
534 # define INT_LEAST64_MAX INT64_MAX
537 #if @HAVE_UINT_LEAST64_T@
538 # ifndef UINT_LEAST64_MAX
539 # if @HAVE_LONG_64BIT@
540 # define UINT_LEAST64_MAX (((1UL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
541 # elif @HAVE_LONG_LONG_64BIT@
542 # define UINT_LEAST64_MAX (((1ULL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
543 # elif defined _MSC_VER
544 # define UINT_LEAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
548 # ifdef _STDINT_H_HAVE_UINT64
549 # define UINT_LEAST64_MAX UINT64_MAX
553 /* 7.18.2.3. Limits of fastest minimum-width integer types */
555 /* Here we assume a standard architecture where the hardware integer
556 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
557 are taken from the same list of types. */
559 #if @HAVE_INT_FAST8_T@
560 # ifndef INT_FAST8_MIN
561 # define INT_FAST8_MIN (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1))
564 # if _STDINT_H_INT64_FASTER_THAN_INT32
565 # define INT_FAST8_MIN INT64_MIN
567 # define INT_FAST8_MIN INT32_MIN
570 #if @HAVE_INT_FAST8_T@
571 # ifndef INT_FAST8_MAX
572 # define INT_FAST8_MAX (~ (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1)))
575 # if _STDINT_H_INT64_FASTER_THAN_INT32
576 # define INT_FAST8_MAX INT64_MAX
578 # define INT_FAST8_MAX INT32_MAX
581 #if @HAVE_UINT_FAST8_T@
582 # ifndef UINT_FAST8_MAX
583 # if @BITSIZEOF_UINT_FAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
584 # define UINT_FAST8_MAX (((1 << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
586 # define UINT_FAST8_MAX (((1UL << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
590 # if _STDINT_H_INT64_FASTER_THAN_INT32
591 # define UINT_FAST8_MAX UINT64_MAX
593 # define UINT_FAST8_MAX UINT32_MAX
597 #if @HAVE_INT_FAST16_T@
598 # ifndef INT_FAST16_MIN
599 # define INT_FAST16_MIN (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1))
602 # if _STDINT_H_INT64_FASTER_THAN_INT32
603 # define INT_FAST16_MIN INT64_MIN
605 # define INT_FAST16_MIN INT32_MIN
608 #if @HAVE_INT_FAST16_T@
609 # ifndef INT_FAST16_MAX
610 # define INT_FAST16_MAX (~ (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1)))
613 # if _STDINT_H_INT64_FASTER_THAN_INT32
614 # define INT_FAST16_MAX INT64_MAX
616 # define INT_FAST16_MAX INT32_MAX
619 #if @HAVE_UINT_FAST16_T@
620 # ifndef UINT_FAST16_MAX
621 # if @BITSIZEOF_UINT_FAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
622 # define UINT_FAST16_MAX (((1 << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
624 # define UINT_FAST16_MAX (((1UL << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
628 # if _STDINT_H_INT64_FASTER_THAN_INT32
629 # define UINT_FAST16_MAX UINT64_MAX
631 # define UINT_FAST16_MAX UINT32_MAX
635 #if @HAVE_INT_FAST32_T@
636 # ifndef INT_FAST32_MIN
637 # define INT_FAST32_MIN (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1))
640 # if _STDINT_H_INT64_FASTER_THAN_INT32
641 # define INT_FAST32_MIN INT64_MIN
643 # define INT_FAST32_MIN INT32_MIN
646 #if @HAVE_INT_FAST32_T@
647 # ifndef INT_FAST32_MAX
648 # define INT_FAST32_MAX (~ (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1)))
651 # if _STDINT_H_INT64_FASTER_THAN_INT32
652 # define INT_FAST32_MAX INT64_MAX
654 # define INT_FAST32_MAX INT32_MAX
657 #if @HAVE_UINT_FAST32_T@
658 # ifndef UINT_FAST32_MAX
659 # if @BITSIZEOF_UINT_FAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
660 # define UINT_FAST32_MAX (((1 << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
662 # define UINT_FAST32_MAX (((1UL << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
666 # if _STDINT_H_INT64_FASTER_THAN_INT32
667 # define UINT_FAST32_MAX UINT64_MAX
669 # define UINT_FAST32_MAX UINT32_MAX
673 #if @HAVE_INT_FAST64_T@
674 # ifndef INT_FAST64_MIN
675 # if @HAVE_LONG_64BIT@
676 # define INT_FAST64_MIN (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1))
677 # elif @HAVE_LONG_LONG_64BIT@
678 # define INT_FAST64_MIN (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1))
679 # elif defined _MSC_VER
680 # define INT_FAST64_MIN (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1))
684 # ifdef _STDINT_H_HAVE_INT64
685 # define INT_FAST64_MIN INT64_MIN
688 #if @HAVE_INT_FAST64_T@
689 # ifndef INT_FAST64_MAX
690 # if @HAVE_LONG_64BIT@
691 # define INT_FAST64_MAX (~ (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1)))
692 # elif @HAVE_LONG_LONG_64BIT@
693 # define INT_FAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1)))
694 # elif defined _MSC_VER
695 # define INT_FAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1)))
699 # ifdef _STDINT_H_HAVE_INT64
700 # define INT_FAST64_MAX INT64_MAX
703 #if @HAVE_UINT_FAST64_T@
704 # ifndef UINT_FAST64_MAX
705 # if @HAVE_LONG_64BIT@
706 # define UINT_FAST64_MAX (((1UL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
707 # elif @HAVE_LONG_LONG_64BIT@
708 # define UINT_FAST64_MAX (((1ULL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
709 # elif defined _MSC_VER
710 # define UINT_FAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
714 # ifdef _STDINT_H_HAVE_UINT64
715 # define UINT_FAST64_MAX UINT64_MAX
719 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
723 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
724 # define INTPTR_MIN (-1LL << (@BITSIZEOF_INTPTR_T@ - 1))
726 # define INTPTR_MIN (-1L << (@BITSIZEOF_INTPTR_T@ - 1))
730 # define INTPTR_MIN LONG_MIN
734 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
735 # define INTPTR_MAX (~ (-1LL << (@BITSIZEOF_INTPTR_T@ - 1)))
737 # define INTPTR_MAX (~ (-1L << (@BITSIZEOF_INTPTR_T@ - 1)))
741 # define INTPTR_MAX LONG_MAX
745 # if @BITSIZEOF_UINTPTR_T@ > @BITSIZEOF_UNSIGNED_LONG@
746 # define UINTPTR_MAX (((1ULL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
748 # define UINTPTR_MAX (((1UL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
752 # define UINTPTR_MAX ULONG_MAX
755 /* 7.18.2.5. Limits of greatest-width integer types */
759 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
760 # define INTMAX_MIN (-1LL << (@BITSIZEOF_INTMAX_T@ - 1))
762 # define INTMAX_MIN (-1L << (@BITSIZEOF_INTMAX_T@ - 1))
766 # ifdef _STDINT_H_HAVE_INT64
767 # define INTMAX_MIN INT64_MIN
769 # define INTMAX_MIN INT32_MIN
774 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
775 # define INTMAX_MAX (~ (-1LL << (@BITSIZEOF_INTMAX_T@ - 1)))
777 # define INTMAX_MAX (~ (-1L << (@BITSIZEOF_INTMAX_T@ - 1)))
781 # ifdef _STDINT_H_HAVE_INT64
782 # define INTMAX_MAX INT64_MAX
784 # define INTMAX_MAX INT32_MAX
789 # if @BITSIZEOF_UINTMAX_T@ > @BITSIZEOF_UNSIGNED_LONG@
790 # define UINTMAX_MAX (((1ULL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
792 # define UINTMAX_MAX (((1UL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
796 # ifdef _STDINT_H_HAVE_INT64
797 # define UINTMAX_MAX UINT64_MAX
799 # define UINTMAX_MAX UINT32_MAX
803 /* 7.18.3. Limits of other integer types */
805 /* ptrdiff_t limits */
807 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
808 # define PTRDIFF_MIN (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1))
810 # define PTRDIFF_MIN (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1))
814 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
815 # define PTRDIFF_MAX (~ (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1)))
817 # define PTRDIFF_MAX (~ (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1)))
821 /* sig_atomic_t limits */
822 #ifndef SIG_ATOMIC_MIN
823 # if @HAVE_SIGNED_SIG_ATOMIC_T@
824 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
825 # define SIG_ATOMIC_MIN (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
827 # define SIG_ATOMIC_MIN (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
830 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
831 # define SIG_ATOMIC_MIN 0UL
832 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
833 # define SIG_ATOMIC_MIN 0U
835 # define SIG_ATOMIC_MIN 0
839 #ifndef SIG_ATOMIC_MAX
840 # if @HAVE_SIGNED_SIG_ATOMIC_T@
841 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
842 # define SIG_ATOMIC_MAX (~ (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
844 # define SIG_ATOMIC_MAX (~ (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
847 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
848 # define SIG_ATOMIC_MAX (((1UL << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
849 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
850 # define SIG_ATOMIC_MAX (((1U << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
852 # define SIG_ATOMIC_MAX (((1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
858 #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
859 # if @BITSIZEOF_SIZE_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIZE_T_UNSIGNED_LONG@
860 # define SIZE_MAX (((1UL << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
862 # define SIZE_MAX (((1U << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
866 /* wchar_t limits may already be defined in <stddef.h>. */
868 # if @HAVE_SIGNED_WCHAR_T@
869 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
870 # define WCHAR_MIN (-1L << (@BITSIZEOF_WCHAR_T@ - 1))
872 # define WCHAR_MIN (-1 << (@BITSIZEOF_WCHAR_T@ - 1))
875 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
876 # define WCHAR_MIN 0UL
877 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
878 # define WCHAR_MIN 0U
885 # if @HAVE_SIGNED_WCHAR_T@
886 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
887 # define WCHAR_MAX (~ (-1L << (@BITSIZEOF_WCHAR_T@ - 1)))
889 # define WCHAR_MAX (~ (-1 << (@BITSIZEOF_WCHAR_T@ - 1)))
892 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
893 # define WCHAR_MAX (((1UL << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
894 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
895 # define WCHAR_MAX (((1U << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
897 # define WCHAR_MAX (((1 << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
904 # if @HAVE_SIGNED_WINT_T@
905 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
906 # define WINT_MIN (-1L << (@BITSIZEOF_WINT_T@ - 1))
908 # define WINT_MIN (-1 << (@BITSIZEOF_WINT_T@ - 1))
911 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
912 # define WINT_MIN 0UL
913 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
921 # if @HAVE_SIGNED_WINT_T@
922 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
923 # define WINT_MAX (~ (-1L << (@BITSIZEOF_WINT_T@ - 1)))
925 # define WINT_MAX (~ (-1 << (@BITSIZEOF_WINT_T@ - 1)))
928 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
929 # define WINT_MAX (((1UL << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
930 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
931 # define WINT_MAX (((1U << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
933 # define WINT_MAX (((1 << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
940 /* 7.18.4. Macros for integer constants */
942 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
944 /* 7.18.4.1. Macros for minimum-width integer constants */
945 /* According to ISO C 99 Technical Corrigendum 1 */
951 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
952 # define UINT8_C(x) x
954 # define UINT8_C(x) x##U
957 # define UINT8_C(x) x
964 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
965 # define UINT16_C(x) x
967 # define UINT16_C(x) x##U
970 # define UINT16_C(x) x
977 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
978 # define UINT32_C(x) x
980 # define UINT32_C(x) x##U
983 # define UINT32_C(x) x
988 #if @HAVE_LONG_64BIT@
989 # define INT64_C(x) x##L
990 # define UINT64_C(x) x##UL
991 #elif @HAVE_LONG_LONG_64BIT@
992 # define INT64_C(x) x##LL
993 # define UINT64_C(x) x##ULL
994 #elif defined(_MSC_VER)
995 # define INT64_C(x) x##i64
996 # define UINT64_C(x) x##ui64
999 /* 7.18.4.2. Macros for greatest-width integer constants */
1003 #if @HAVE_LONG_64BIT@
1004 # define INTMAX_C(x) x##L
1005 # define UINTMAX_C(x) x##UL
1006 #elif @HAVE_LONG_LONG_64BIT@
1007 # define INTMAX_C(x) x##LL
1008 # define UINTMAX_C(x) x##ULL
1009 #elif defined(_MSC_VER)
1010 # define INTMAX_C(x) x##i64
1011 # define UINTMAX_C(x) x##ui64
1013 # define INTMAX_C(x) x
1014 # define UINTMAX_C(x) x##U
1019 #endif /* _STDINT_H */