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 /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
32 /* Get those types that are already defined in other system include files. */
33 #if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
34 # include <sys/inttypes.h>
36 #if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
37 /* In OpenBSD 3.8, <sys/types.h> includes <machine/types.h>, which defines
38 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
39 <inttypes.h> includes <machine/types.h> and also defines intptr_t and
41 /* BSD/OS 4.2 is similar, but doesn't have <inttypes.h> */
42 /* IRIX 6.5 has <inttypes.h>, and <sys/types.h> defines some of these
44 # include <sys/types.h>
45 # if @HAVE_INTTYPES_H@
46 # include @FULL_PATH_INTTYPES_H@
49 #if defined(__linux__) && @HAVE_SYS_BITYPES_H@
50 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
51 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
52 included by <sys/types.h>. */
53 # include <sys/bitypes.h>
55 #if defined(__sun) && @HAVE_SYS_INTTYPES_H@
56 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
57 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
58 But note that <sys/int_types.h> contains only the type definitions! */
59 # include <sys/inttypes.h>
61 #if (defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@
62 /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
63 UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
64 /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
65 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
66 # include @FULL_PATH_INTTYPES_H@
69 /* Other systems may have an incomplete <stdint.h>. */
70 # include @FULL_PATH_STDINT_H@
73 /* 7.18.1.1. Exact-width integer types */
75 /* Here we assume a standard architecture where the hardware integer
76 types have 8, 16, 32, optionally 64 bits. */
79 typedef signed char int8_t;
82 typedef unsigned char uint8_t;
83 # define _UINT8_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
87 typedef short int16_t;
90 typedef unsigned short uint16_t;
97 typedef unsigned int uint32_t;
98 # define _UINT32_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
102 # define _STDINT_H_HAVE_INT64 1
104 # if @HAVE_LONG_64BIT@
105 typedef long int64_t;
106 # define _STDINT_H_HAVE_INT64 1
107 # elif @HAVE_LONG_LONG_64BIT@
108 typedef long long int64_t;
109 # define _STDINT_H_HAVE_INT64 1
110 # elif defined _MSC_VER
111 typedef __int64 int64_t;
112 # define _STDINT_H_HAVE_INT64 1
116 # define _STDINT_H_HAVE_UINT64 1
118 # if @HAVE_LONG_64BIT@
119 typedef unsigned long uint64_t;
120 # define _STDINT_H_HAVE_UINT64 1
121 # elif @HAVE_LONG_LONG_64BIT@
122 typedef unsigned long long uint64_t;
123 # define _UINT64_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
124 # define _STDINT_H_HAVE_UINT64 1
125 # elif defined _MSC_VER
126 typedef unsigned __int64 uint64_t;
127 # define _STDINT_H_HAVE_UINT64 1
131 /* 7.18.1.2. Minimum-width integer types */
133 /* Here we assume a standard architecture where the hardware integer
134 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
135 are the same as the corresponding N_t types. */
137 #if !@HAVE_INT_LEAST8_T@
138 typedef int8_t int_least8_t;
140 #if !@HAVE_UINT_LEAST8_T@
141 typedef uint8_t uint_least8_t;
144 #if !@HAVE_INT_LEAST16_T@
145 typedef int16_t int_least16_t;
147 #if !@HAVE_UINT_LEAST16_T@
148 typedef uint16_t uint_least16_t;
151 #if !@HAVE_INT_LEAST32_T@
152 typedef int32_t int_least32_t;
154 #if !@HAVE_UINT_LEAST32_T@
155 typedef uint32_t uint_least32_t;
158 #if !@HAVE_INT_LEAST64_T@ && _STDINT_H_HAVE_INT64
159 typedef int64_t int_least64_t;
161 #if !@HAVE_UINT_LEAST64_T@ && _STDINT_H_HAVE_UINT64
162 typedef uint64_t uint_least64_t;
165 /* 7.18.1.3. Fastest minimum-width integer types */
167 /* Note: Other <stdint.h> substitutes may define these types differently.
168 It is not recommended to use these types in public header files. */
170 /* Here we assume a standard architecture where the hardware integer
171 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
172 are taken from the same list of types. */
174 /* On alpha processors, int32_t variables are slower than int64_t variables,
175 due to the necessary zap instructions. */
177 # define _STDINT_H_INT64_FASTER_THAN_INT32 1
180 #if !@HAVE_INT_FAST8_T@
181 # if _STDINT_H_INT64_FASTER_THAN_INT32
182 typedef int64_t int_fast8_t;
184 typedef int32_t int_fast8_t;
187 #if !@HAVE_UINT_FAST8_T@
188 # if _STDINT_H_INT64_FASTER_THAN_INT32
189 typedef uint64_t uint_fast8_t;
191 typedef uint32_t uint_fast8_t;
195 #if !@HAVE_INT_FAST16_T@
196 # if _STDINT_H_INT64_FASTER_THAN_INT32
197 typedef int64_t int_fast16_t;
199 typedef int32_t int_fast16_t;
202 #if !@HAVE_UINT_FAST16_T@
203 # if _STDINT_H_INT64_FASTER_THAN_INT32
204 typedef uint64_t uint_fast16_t;
206 typedef uint32_t uint_fast16_t;
210 #if !@HAVE_INT_FAST32_T@
211 # if _STDINT_H_INT64_FASTER_THAN_INT32
212 typedef int64_t int_fast32_t;
214 typedef int32_t int_fast32_t;
217 #if !@HAVE_UINT_FAST32_T@
218 # if _STDINT_H_INT64_FASTER_THAN_INT32
219 typedef uint64_t uint_fast32_t;
221 typedef uint32_t uint_fast32_t;
225 #if !@HAVE_INT_FAST64_T@ && _STDINT_H_HAVE_INT64
226 typedef int64_t int_fast64_t;
228 #if !@HAVE_UINT_FAST64_T@ && _STDINT_H_HAVE_UINT64
229 typedef uint64_t uint_fast64_t;
232 /* 7.18.1.4. Integer types capable of holding object pointers */
234 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
235 but this doesn't matter here. */
237 typedef long intptr_t;
239 #if !@HAVE_UINTPTR_T@
240 typedef unsigned long uintptr_t;
243 /* 7.18.1.5. Greatest-width integer types */
245 /* Note: These types are compiler dependent. It may be unwise to use them in
246 public header files. */
249 # ifdef _STDINT_H_HAVE_INT64
250 typedef int64_t intmax_t;
252 typedef int32_t intmax_t;
255 #if !@HAVE_UINTMAX_T@
256 # ifdef _STDINT_H_HAVE_UINT64
257 typedef uint64_t uintmax_t;
259 typedef uint32_t uintmax_t;
263 /* 7.18.2. Limits of specified-width integer types */
265 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
267 /* 7.18.2.1. Limits of exact-width integer types */
269 /* Here we assume a standard architecture where the hardware integer
270 types have 8, 16, 32, optionally 64 bits. */
274 # define INT8_MIN (-1 << (@BITSIZEOF_INT8_T@ - 1))
277 # define INT8_MIN -128
281 # define INT8_MAX (~ (-1 << (@BITSIZEOF_INT8_T@ - 1)))
284 # define INT8_MAX 127
288 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
289 # define UINT8_MAX (((1 << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
291 # define UINT8_MAX (((1U << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
295 # define UINT8_MAX 255
300 # define INT16_MIN (-1 << (@BITSIZEOF_INT16_T@ - 1))
303 # define INT16_MIN -32768
307 # define INT16_MAX (~ (-1 << (@BITSIZEOF_INT16_T@ - 1)))
310 # define INT16_MAX 32767
314 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
315 # define UINT16_MAX (((1 << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
317 # define UINT16_MAX (((1U << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
321 # define UINT16_MAX 65535
326 # define INT32_MIN (-1 << (@BITSIZEOF_INT32_T@ - 1))
329 # define INT32_MIN (~INT32_MAX)
333 # define INT32_MAX (~ (-1 << (@BITSIZEOF_INT32_T@ - 1)))
336 # define INT32_MAX 2147483647
340 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
341 # define UINT32_MAX (((1 << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
343 # define UINT32_MAX (((1U << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
347 # define UINT32_MAX 4294967295U
352 # if @HAVE_LONG_64BIT@
353 # define INT64_MIN (-1L << (@BITSIZEOF_INT64_T@ - 1))
354 # elif @HAVE_LONG_LONG_64BIT@
355 # define INT64_MIN (-1LL << (@BITSIZEOF_INT64_T@ - 1))
356 # elif defined _MSC_VER
357 # define INT64_MIN (-1i64 << (@BITSIZEOF_INT64_T@ - 1))
361 # ifdef _STDINT_H_HAVE_INT64
362 # define INT64_MIN (~INT64_MAX)
367 # if @HAVE_LONG_64BIT@
368 # define INT64_MAX (~ (-1L << (@BITSIZEOF_INT64_T@ - 1)))
369 # elif @HAVE_LONG_LONG_64BIT@
370 # define INT64_MAX (~ (-1LL << (@BITSIZEOF_INT64_T@ - 1)))
371 # elif defined _MSC_VER
372 # define INT64_MAX (~ (-1i64 << (@BITSIZEOF_INT64_T@ - 1)))
376 # ifdef _STDINT_H_HAVE_INT64
377 # if @HAVE_LONG_64BIT@
378 # define INT64_MAX 9223372036854775807L
379 # elif @HAVE_LONG_LONG_64BIT@
380 # define INT64_MAX 9223372036854775807LL
381 # elif defined _MSC_VER
382 # define INT64_MAX 9223372036854775807i64
388 # if @HAVE_LONG_64BIT@
389 # define UINT64_MAX (((1UL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
390 # elif @HAVE_LONG_LONG_64BIT@
391 # define UINT64_MAX (((1ULL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
392 # elif defined _MSC_VER
393 # define UINT64_MAX (((1ui64 << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
397 # ifdef _STDINT_H_HAVE_UINT64
398 # if @HAVE_LONG_64BIT@
399 # define UINT64_MAX 18446744073709551615UL
400 # elif @HAVE_LONG_LONG_64BIT@
401 # define UINT64_MAX 18446744073709551615ULL
402 # elif defined _MSC_VER
403 # define UINT64_MAX 18446744073709551615ui64
408 /* 7.18.2.2. Limits of minimum-width integer types */
410 /* Here we assume a standard architecture where the hardware integer
411 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
412 are the same as the corresponding N_t types. */
414 #if @HAVE_INT_LEAST8_T@
415 # ifndef INT_LEAST8_MIN
416 # define INT_LEAST8_MIN (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1))
419 # define INT_LEAST8_MIN INT8_MIN
421 #if @HAVE_INT_LEAST8_T@
422 # ifndef INT_LEAST8_MAX
423 # define INT_LEAST8_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1)))
426 # define INT_LEAST8_MAX INT8_MAX
428 #if @HAVE_UINT_LEAST8_T@
429 # ifndef UINT_LEAST8_MAX
430 # if @BITSIZEOF_UINT_LEAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
431 # define UINT_LEAST8_MAX (((1 << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
433 # define UINT_LEAST8_MAX (((1U << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
437 # define UINT_LEAST8_MAX UINT8_MAX
440 #if @HAVE_INT_LEAST16_T@
441 # ifndef INT_LEAST16_MIN
442 # define INT_LEAST16_MIN (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1))
445 # define INT_LEAST16_MIN INT16_MIN
447 #if @HAVE_INT_LEAST16_T@
448 # ifndef INT_LEAST16_MAX
449 # define INT_LEAST16_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1)))
452 # define INT_LEAST16_MAX INT16_MAX
454 #if @HAVE_UINT_LEAST16_T@
455 # ifndef UINT_LEAST16_MAX
456 # if @BITSIZEOF_UINT_LEAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
457 # define UINT_LEAST16_MAX (((1 << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
459 # define UINT_LEAST16_MAX (((1U << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
463 # define UINT_LEAST16_MAX UINT16_MAX
466 #if @HAVE_INT_LEAST32_T@
467 # ifndef INT_LEAST32_MIN
468 # define INT_LEAST32_MIN (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1))
471 # define INT_LEAST32_MIN INT32_MIN
473 #if @HAVE_INT_LEAST32_T@
474 # ifndef INT_LEAST32_MAX
475 # define INT_LEAST32_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1)))
478 # define INT_LEAST32_MAX INT32_MAX
480 #if @HAVE_UINT_LEAST32_T@
481 # ifndef UINT_LEAST32_MAX
482 # if @BITSIZEOF_UINT_LEAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
483 # define UINT_LEAST32_MAX (((1 << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
485 # define UINT_LEAST32_MAX (((1U << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
489 # define UINT_LEAST32_MAX UINT32_MAX
492 #if @HAVE_INT_LEAST64_T@
493 # ifndef INT_LEAST64_MIN
494 # if @HAVE_LONG_64BIT@
495 # define INT_LEAST64_MIN (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1))
496 # elif @HAVE_LONG_LONG_64BIT@
497 # define INT_LEAST64_MIN (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1))
498 # elif defined _MSC_VER
499 # define INT_LEAST64_MIN (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1))
503 # ifdef _STDINT_H_HAVE_INT64
504 # define INT_LEAST64_MIN INT64_MIN
507 #if @HAVE_INT_LEAST64_T@
508 # ifndef INT_LEAST64_MAX
509 # if @HAVE_LONG_64BIT@
510 # define INT_LEAST64_MAX (~ (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
511 # elif @HAVE_LONG_LONG_64BIT@
512 # define INT_LEAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
513 # elif defined _MSC_VER
514 # define INT_LEAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
518 # ifdef _STDINT_H_HAVE_INT64
519 # define INT_LEAST64_MAX INT64_MAX
522 #if @HAVE_UINT_LEAST64_T@
523 # ifndef UINT_LEAST64_MAX
524 # if @HAVE_LONG_64BIT@
525 # define UINT_LEAST64_MAX (((1UL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
526 # elif @HAVE_LONG_LONG_64BIT@
527 # define UINT_LEAST64_MAX (((1ULL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
528 # elif defined _MSC_VER
529 # define UINT_LEAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
533 # ifdef _STDINT_H_HAVE_UINT64
534 # define UINT_LEAST64_MAX UINT64_MAX
538 /* 7.18.2.3. Limits of fastest minimum-width integer types */
540 /* Here we assume a standard architecture where the hardware integer
541 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
542 are taken from the same list of types. */
544 #if @HAVE_INT_FAST8_T@
545 # ifndef INT_FAST8_MIN
546 # define INT_FAST8_MIN (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1))
549 # if _STDINT_H_INT64_FASTER_THAN_INT32
550 # define INT_FAST8_MIN INT64_MIN
552 # define INT_FAST8_MIN INT32_MIN
555 #if @HAVE_INT_FAST8_T@
556 # ifndef INT_FAST8_MAX
557 # define INT_FAST8_MAX (~ (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1)))
560 # if _STDINT_H_INT64_FASTER_THAN_INT32
561 # define INT_FAST8_MAX INT64_MAX
563 # define INT_FAST8_MAX INT32_MAX
566 #if @HAVE_UINT_FAST8_T@
567 # ifndef UINT_FAST8_MAX
568 # if @BITSIZEOF_UINT_FAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
569 # define UINT_FAST8_MAX (((1 << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
571 # define UINT_FAST8_MAX (((1UL << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
575 # if _STDINT_H_INT64_FASTER_THAN_INT32
576 # define UINT_FAST8_MAX UINT64_MAX
578 # define UINT_FAST8_MAX UINT32_MAX
582 #if @HAVE_INT_FAST16_T@
583 # ifndef INT_FAST16_MIN
584 # define INT_FAST16_MIN (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1))
587 # if _STDINT_H_INT64_FASTER_THAN_INT32
588 # define INT_FAST16_MIN INT64_MIN
590 # define INT_FAST16_MIN INT32_MIN
593 #if @HAVE_INT_FAST16_T@
594 # ifndef INT_FAST16_MAX
595 # define INT_FAST16_MAX (~ (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1)))
598 # if _STDINT_H_INT64_FASTER_THAN_INT32
599 # define INT_FAST16_MAX INT64_MAX
601 # define INT_FAST16_MAX INT32_MAX
604 #if @HAVE_UINT_FAST16_T@
605 # ifndef UINT_FAST16_MAX
606 # if @BITSIZEOF_UINT_FAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
607 # define UINT_FAST16_MAX (((1 << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
609 # define UINT_FAST16_MAX (((1UL << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
613 # if _STDINT_H_INT64_FASTER_THAN_INT32
614 # define UINT_FAST16_MAX UINT64_MAX
616 # define UINT_FAST16_MAX UINT32_MAX
620 #if @HAVE_INT_FAST32_T@
621 # ifndef INT_FAST32_MIN
622 # define INT_FAST32_MIN (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1))
625 # if _STDINT_H_INT64_FASTER_THAN_INT32
626 # define INT_FAST32_MIN INT64_MIN
628 # define INT_FAST32_MIN INT32_MIN
631 #if @HAVE_INT_FAST32_T@
632 # ifndef INT_FAST32_MAX
633 # define INT_FAST32_MAX (~ (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1)))
636 # if _STDINT_H_INT64_FASTER_THAN_INT32
637 # define INT_FAST32_MAX INT64_MAX
639 # define INT_FAST32_MAX INT32_MAX
642 #if @HAVE_UINT_FAST32_T@
643 # ifndef UINT_FAST32_MAX
644 # if @BITSIZEOF_UINT_FAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
645 # define UINT_FAST32_MAX (((1 << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
647 # define UINT_FAST32_MAX (((1UL << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
651 # if _STDINT_H_INT64_FASTER_THAN_INT32
652 # define UINT_FAST32_MAX UINT64_MAX
654 # define UINT_FAST32_MAX UINT32_MAX
658 #if @HAVE_INT_FAST64_T@
659 # ifndef INT_FAST64_MIN
660 # if @HAVE_LONG_64BIT@
661 # define INT_FAST64_MIN (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1))
662 # elif @HAVE_LONG_LONG_64BIT@
663 # define INT_FAST64_MIN (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1))
664 # elif defined _MSC_VER
665 # define INT_FAST64_MIN (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1))
669 # ifdef _STDINT_H_HAVE_INT64
670 # define INT_FAST64_MIN INT64_MIN
673 #if @HAVE_INT_FAST64_T@
674 # ifndef INT_FAST64_MAX
675 # if @HAVE_LONG_64BIT@
676 # define INT_FAST64_MAX (~ (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1)))
677 # elif @HAVE_LONG_LONG_64BIT@
678 # define INT_FAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1)))
679 # elif defined _MSC_VER
680 # define INT_FAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1)))
684 # ifdef _STDINT_H_HAVE_INT64
685 # define INT_FAST64_MAX INT64_MAX
688 #if @HAVE_UINT_FAST64_T@
689 # ifndef UINT_FAST64_MAX
690 # if @HAVE_LONG_64BIT@
691 # define UINT_FAST64_MAX (((1UL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
692 # elif @HAVE_LONG_LONG_64BIT@
693 # define UINT_FAST64_MAX (((1ULL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
694 # elif defined _MSC_VER
695 # define UINT_FAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
699 # ifdef _STDINT_H_HAVE_UINT64
700 # define UINT_FAST64_MAX UINT64_MAX
704 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
708 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
709 # define INTPTR_MIN (-1LL << (@BITSIZEOF_INTPTR_T@ - 1))
711 # define INTPTR_MIN (-1L << (@BITSIZEOF_INTPTR_T@ - 1))
715 # define INTPTR_MIN LONG_MIN
719 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
720 # define INTPTR_MAX (~ (-1LL << (@BITSIZEOF_INTPTR_T@ - 1)))
722 # define INTPTR_MAX (~ (-1L << (@BITSIZEOF_INTPTR_T@ - 1)))
726 # define INTPTR_MAX LONG_MAX
730 # if @BITSIZEOF_UINTPTR_T@ > @BITSIZEOF_UNSIGNED_LONG@
731 # define UINTPTR_MAX (((1ULL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
733 # define UINTPTR_MAX (((1UL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
737 # define UINTPTR_MAX ULONG_MAX
740 /* 7.18.2.5. Limits of greatest-width integer types */
744 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
745 # define INTMAX_MIN (-1LL << (@BITSIZEOF_INTMAX_T@ - 1))
747 # define INTMAX_MIN (-1L << (@BITSIZEOF_INTMAX_T@ - 1))
751 # ifdef _STDINT_H_HAVE_INT64
752 # define INTMAX_MIN INT64_MIN
754 # define INTMAX_MIN INT32_MIN
759 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
760 # define INTMAX_MAX (~ (-1LL << (@BITSIZEOF_INTMAX_T@ - 1)))
762 # define INTMAX_MAX (~ (-1L << (@BITSIZEOF_INTMAX_T@ - 1)))
766 # ifdef _STDINT_H_HAVE_INT64
767 # define INTMAX_MAX INT64_MAX
769 # define INTMAX_MAX INT32_MAX
774 # if @BITSIZEOF_UINTMAX_T@ > @BITSIZEOF_UNSIGNED_LONG@
775 # define UINTMAX_MAX (((1ULL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
777 # define UINTMAX_MAX (((1UL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
781 # ifdef _STDINT_H_HAVE_INT64
782 # define UINTMAX_MAX UINT64_MAX
784 # define UINTMAX_MAX UINT32_MAX
788 /* 7.18.3. Limits of other integer types */
790 /* ptrdiff_t limits */
792 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
793 # define PTRDIFF_MIN (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1))
795 # define PTRDIFF_MIN (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1))
799 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
800 # define PTRDIFF_MAX (~ (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1)))
802 # define PTRDIFF_MAX (~ (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1)))
806 /* sig_atomic_t limits */
807 #ifndef SIG_ATOMIC_MIN
808 # if @HAVE_SIGNED_SIG_ATOMIC_T@
809 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
810 # define SIG_ATOMIC_MIN (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
812 # define SIG_ATOMIC_MIN (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
815 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
816 # define SIG_ATOMIC_MIN 0UL
817 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
818 # define SIG_ATOMIC_MIN 0U
820 # define SIG_ATOMIC_MIN 0
824 #ifndef SIG_ATOMIC_MAX
825 # if @HAVE_SIGNED_SIG_ATOMIC_T@
826 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
827 # define SIG_ATOMIC_MAX (~ (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
829 # define SIG_ATOMIC_MAX (~ (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
832 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
833 # define SIG_ATOMIC_MAX (((1UL << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
834 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
835 # define SIG_ATOMIC_MAX (((1U << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
837 # define SIG_ATOMIC_MAX (((1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
843 #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
844 # if @BITSIZEOF_SIZE_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIZE_T_UNSIGNED_LONG@
845 # define SIZE_MAX (((1UL << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
847 # define SIZE_MAX (((1U << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
851 /* wchar_t limits may already be defined in <stddef.h>. */
853 # if @HAVE_SIGNED_WCHAR_T@
854 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
855 # define WCHAR_MIN (-1L << (@BITSIZEOF_WCHAR_T@ - 1))
857 # define WCHAR_MIN (-1 << (@BITSIZEOF_WCHAR_T@ - 1))
860 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
861 # define WCHAR_MIN 0UL
862 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
863 # define WCHAR_MIN 0U
870 # if @HAVE_SIGNED_WCHAR_T@
871 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
872 # define WCHAR_MAX (~ (-1L << (@BITSIZEOF_WCHAR_T@ - 1)))
874 # define WCHAR_MAX (~ (-1 << (@BITSIZEOF_WCHAR_T@ - 1)))
877 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
878 # define WCHAR_MAX (((1UL << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
879 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
880 # define WCHAR_MAX (((1U << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
882 # define WCHAR_MAX (((1 << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
889 # if @HAVE_SIGNED_WINT_T@
890 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
891 # define WINT_MIN (-1L << (@BITSIZEOF_WINT_T@ - 1))
893 # define WINT_MIN (-1 << (@BITSIZEOF_WINT_T@ - 1))
896 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
897 # define WINT_MIN 0UL
898 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
906 # if @HAVE_SIGNED_WINT_T@
907 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
908 # define WINT_MAX (~ (-1L << (@BITSIZEOF_WINT_T@ - 1)))
910 # define WINT_MAX (~ (-1 << (@BITSIZEOF_WINT_T@ - 1)))
913 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
914 # define WINT_MAX (((1UL << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
915 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
916 # define WINT_MAX (((1U << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
918 # define WINT_MAX (((1 << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
925 /* 7.18.4. Macros for integer constants */
927 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
929 /* 7.18.4.1. Macros for minimum-width integer constants */
930 /* According to ISO C 99 Technical Corrigendum 1 */
936 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
937 # define UINT8_C(x) x
939 # define UINT8_C(x) x##U
942 # define UINT8_C(x) x
949 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
950 # define UINT16_C(x) x
952 # define UINT16_C(x) x##U
955 # define UINT16_C(x) x
962 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
963 # define UINT32_C(x) x
965 # define UINT32_C(x) x##U
968 # define UINT32_C(x) x
973 #if @HAVE_LONG_64BIT@
974 # define INT64_C(x) x##L
975 # define UINT64_C(x) x##UL
976 #elif @HAVE_LONG_LONG_64BIT@
977 # define INT64_C(x) x##LL
978 # define UINT64_C(x) x##ULL
979 #elif defined(_MSC_VER)
980 # define INT64_C(x) x##i64
981 # define UINT64_C(x) x##ui64
984 /* 7.18.4.2. Macros for greatest-width integer constants */
988 #if @HAVE_LONG_64BIT@
989 # define INTMAX_C(x) x##L
990 # define UINTMAX_C(x) x##UL
991 #elif @HAVE_LONG_LONG_64BIT@
992 # define INTMAX_C(x) x##LL
993 # define UINTMAX_C(x) x##ULL
994 #elif defined(_MSC_VER)
995 # define INTMAX_C(x) x##i64
996 # define UINTMAX_C(x) x##ui64
998 # define INTMAX_C(x) x
999 # define UINTMAX_C(x) x##U
1004 #endif /* _STDINT_H */