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(__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 /* IRIX 6.5 has <inttypes.h>, and <sys/types.h> defines some of these
43 # include <sys/types.h>
44 # if @HAVE_INTTYPES_H@
45 # include @FULL_PATH_INTTYPES_H@
48 #if defined(__linux__) && @HAVE_SYS_BITYPES_H@
49 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
50 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
51 included by <sys/types.h>. */
52 # include <sys/bitypes.h>
54 #if defined(__sun) && @HAVE_SYS_INTTYPES_H@
55 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
56 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
57 But note that <sys/int_types.h> contains only the type definitions! */
58 # include <sys/inttypes.h>
60 #if (defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@
61 /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
62 UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
63 /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
64 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
65 # include @FULL_PATH_INTTYPES_H@
68 /* Other systems may have an incomplete <stdint.h>. */
69 # include @FULL_PATH_STDINT_H@
72 /* 7.18.1.1. Exact-width integer types */
74 /* Here we assume a standard architecture where the hardware integer
75 types have 8, 16, 32, optionally 64 bits. */
78 typedef signed char int8_t;
81 typedef unsigned char uint8_t;
82 # define _UINT8_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
86 typedef short int16_t;
89 typedef unsigned short uint16_t;
96 typedef unsigned int uint32_t;
97 # define _UINT32_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
101 # define _STDINT_H_HAVE_INT64 1
103 # if @HAVE_LONG_64BIT@
104 typedef long int64_t;
105 # define _STDINT_H_HAVE_INT64 1
106 # elif @HAVE_LONG_LONG_64BIT@
107 typedef long long int64_t;
108 # define _STDINT_H_HAVE_INT64 1
109 # elif defined _MSC_VER
110 typedef __int64 int64_t;
111 # define _STDINT_H_HAVE_INT64 1
115 # define _STDINT_H_HAVE_UINT64 1
117 # if @HAVE_LONG_64BIT@
118 typedef unsigned long uint64_t;
119 # define _STDINT_H_HAVE_UINT64 1
120 # elif @HAVE_LONG_LONG_64BIT@
121 typedef unsigned long long uint64_t;
122 # define _UINT64_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
123 # define _STDINT_H_HAVE_UINT64 1
124 # elif defined _MSC_VER
125 typedef unsigned __int64 uint64_t;
126 # define _STDINT_H_HAVE_UINT64 1
130 /* 7.18.1.2. Minimum-width integer types */
132 /* Here we assume a standard architecture where the hardware integer
133 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
134 are the same as the corresponding N_t types. */
136 #if !@HAVE_INT_LEAST8_T@
137 typedef int8_t int_least8_t;
139 #if !@HAVE_UINT_LEAST8_T@
140 typedef uint8_t uint_least8_t;
143 #if !@HAVE_INT_LEAST16_T@
144 typedef int16_t int_least16_t;
146 #if !@HAVE_UINT_LEAST16_T@
147 typedef uint16_t uint_least16_t;
150 #if !@HAVE_INT_LEAST32_T@
151 typedef int32_t int_least32_t;
153 #if !@HAVE_UINT_LEAST32_T@
154 typedef uint32_t uint_least32_t;
157 #if !@HAVE_INT_LEAST64_T@ && _STDINT_H_HAVE_INT64
158 typedef int64_t int_least64_t;
160 #if !@HAVE_UINT_LEAST64_T@ && _STDINT_H_HAVE_UINT64
161 typedef uint64_t uint_least64_t;
164 /* 7.18.1.3. Fastest minimum-width integer types */
166 /* Note: Other <stdint.h> substitutes may define these types differently.
167 It is not recommended to use these types in public header files. */
169 /* Here we assume a standard architecture where the hardware integer
170 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
171 are taken from the same list of types. */
173 /* On alpha processors, int32_t variables are slower than int64_t variables,
174 due to the necessary zap instructions. */
176 # define _STDINT_H_INT64_FASTER_THAN_INT32 1
179 #if !@HAVE_INT_FAST8_T@
180 # if _STDINT_H_INT64_FASTER_THAN_INT32
181 typedef int64_t int_fast8_t;
183 typedef int32_t int_fast8_t;
186 #if !@HAVE_UINT_FAST8_T@
187 # if _STDINT_H_INT64_FASTER_THAN_INT32
188 typedef uint64_t uint_fast8_t;
190 typedef uint32_t uint_fast8_t;
194 #if !@HAVE_INT_FAST16_T@
195 # if _STDINT_H_INT64_FASTER_THAN_INT32
196 typedef int64_t int_fast16_t;
198 typedef int32_t int_fast16_t;
201 #if !@HAVE_UINT_FAST16_T@
202 # if _STDINT_H_INT64_FASTER_THAN_INT32
203 typedef uint64_t uint_fast16_t;
205 typedef uint32_t uint_fast16_t;
209 #if !@HAVE_INT_FAST32_T@
210 # if _STDINT_H_INT64_FASTER_THAN_INT32
211 typedef int64_t int_fast32_t;
213 typedef int32_t int_fast32_t;
216 #if !@HAVE_UINT_FAST32_T@
217 # if _STDINT_H_INT64_FASTER_THAN_INT32
218 typedef uint64_t uint_fast32_t;
220 typedef uint32_t uint_fast32_t;
224 #if !@HAVE_INT_FAST64_T@ && _STDINT_H_HAVE_INT64
225 typedef int64_t int_fast64_t;
227 #if !@HAVE_UINT_FAST64_T@ && _STDINT_H_HAVE_UINT64
228 typedef uint64_t uint_fast64_t;
231 /* 7.18.1.4. Integer types capable of holding object pointers */
233 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
234 but this doesn't matter here. */
236 typedef long intptr_t;
238 #if !@HAVE_UINTPTR_T@
239 typedef unsigned long uintptr_t;
242 /* 7.18.1.5. Greatest-width integer types */
244 /* Note: These types are compiler dependent. It may be unwise to use them in
245 public header files. */
248 # ifdef _STDINT_H_HAVE_INT64
249 typedef int64_t intmax_t;
251 typedef int32_t intmax_t;
254 #if !@HAVE_UINTMAX_T@
255 # ifdef _STDINT_H_HAVE_UINT64
256 typedef uint64_t uintmax_t;
258 typedef uint32_t uintmax_t;
262 /* 7.18.2. Limits of specified-width integer types */
264 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
266 /* 7.18.2.1. Limits of exact-width integer types */
268 /* Here we assume a standard architecture where the hardware integer
269 types have 8, 16, 32, optionally 64 bits. */
273 # define INT8_MIN (-1 << (@BITSIZEOF_INT8_T@ - 1))
276 # define INT8_MIN -128
280 # define INT8_MAX (~ (-1 << (@BITSIZEOF_INT8_T@ - 1)))
283 # define INT8_MAX 127
287 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
288 # define UINT8_MAX (((1 << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
290 # define UINT8_MAX (((1U << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
294 # define UINT8_MAX 255
299 # define INT16_MIN (-1 << (@BITSIZEOF_INT16_T@ - 1))
302 # define INT16_MIN -32768
306 # define INT16_MAX (~ (-1 << (@BITSIZEOF_INT16_T@ - 1)))
309 # define INT16_MAX 32767
313 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
314 # define UINT16_MAX (((1 << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
316 # define UINT16_MAX (((1U << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
320 # define UINT16_MAX 65535
325 # define INT32_MIN (-1 << (@BITSIZEOF_INT32_T@ - 1))
328 # define INT32_MIN (~INT32_MAX)
332 # define INT32_MAX (~ (-1 << (@BITSIZEOF_INT32_T@ - 1)))
335 # define INT32_MAX 2147483647
339 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
340 # define UINT32_MAX (((1 << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
342 # define UINT32_MAX (((1U << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
346 # define UINT32_MAX 4294967295U
351 # if @HAVE_LONG_64BIT@
352 # define INT64_MIN (-1L << (@BITSIZEOF_INT64_T@ - 1))
353 # elif @HAVE_LONG_LONG_64BIT@
354 # define INT64_MIN (-1LL << (@BITSIZEOF_INT64_T@ - 1))
355 # elif defined _MSC_VER
356 # define INT64_MIN (-1i64 << (@BITSIZEOF_INT64_T@ - 1))
360 # ifdef _STDINT_H_HAVE_INT64
361 # define INT64_MIN (~INT64_MAX)
366 # if @HAVE_LONG_64BIT@
367 # define INT64_MAX (~ (-1L << (@BITSIZEOF_INT64_T@ - 1)))
368 # elif @HAVE_LONG_LONG_64BIT@
369 # define INT64_MAX (~ (-1LL << (@BITSIZEOF_INT64_T@ - 1)))
370 # elif defined _MSC_VER
371 # define INT64_MAX (~ (-1i64 << (@BITSIZEOF_INT64_T@ - 1)))
375 # ifdef _STDINT_H_HAVE_INT64
376 # if @HAVE_LONG_64BIT@
377 # define INT64_MAX 9223372036854775807L
378 # elif @HAVE_LONG_LONG_64BIT@
379 # define INT64_MAX 9223372036854775807LL
380 # elif defined _MSC_VER
381 # define INT64_MAX 9223372036854775807i64
387 # if @HAVE_LONG_64BIT@
388 # define UINT64_MAX (((1UL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
389 # elif @HAVE_LONG_LONG_64BIT@
390 # define UINT64_MAX (((1ULL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
391 # elif defined _MSC_VER
392 # define UINT64_MAX (((1ui64 << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
396 # ifdef _STDINT_H_HAVE_UINT64
397 # if @HAVE_LONG_64BIT@
398 # define UINT64_MAX 18446744073709551615UL
399 # elif @HAVE_LONG_LONG_64BIT@
400 # define UINT64_MAX 18446744073709551615ULL
401 # elif defined _MSC_VER
402 # define UINT64_MAX 18446744073709551615ui64
407 /* 7.18.2.2. Limits of minimum-width integer types */
409 /* Here we assume a standard architecture where the hardware integer
410 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
411 are the same as the corresponding N_t types. */
413 #if @HAVE_INT_LEAST8_T@
414 # ifndef INT_LEAST8_MIN
415 # define INT_LEAST8_MIN (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1))
418 # define INT_LEAST8_MIN INT8_MIN
420 #if @HAVE_INT_LEAST8_T@
421 # ifndef INT_LEAST8_MAX
422 # define INT_LEAST8_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1)))
425 # define INT_LEAST8_MAX INT8_MAX
427 #if @HAVE_UINT_LEAST8_T@
428 # ifndef UINT_LEAST8_MAX
429 # if @BITSIZEOF_UINT_LEAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
430 # define UINT_LEAST8_MAX (((1 << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
432 # define UINT_LEAST8_MAX (((1U << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
436 # define UINT_LEAST8_MAX UINT8_MAX
439 #if @HAVE_INT_LEAST16_T@
440 # ifndef INT_LEAST16_MIN
441 # define INT_LEAST16_MIN (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1))
444 # define INT_LEAST16_MIN INT16_MIN
446 #if @HAVE_INT_LEAST16_T@
447 # ifndef INT_LEAST16_MAX
448 # define INT_LEAST16_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1)))
451 # define INT_LEAST16_MAX INT16_MAX
453 #if @HAVE_UINT_LEAST16_T@
454 # ifndef UINT_LEAST16_MAX
455 # if @BITSIZEOF_UINT_LEAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
456 # define UINT_LEAST16_MAX (((1 << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
458 # define UINT_LEAST16_MAX (((1U << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
462 # define UINT_LEAST16_MAX UINT16_MAX
465 #if @HAVE_INT_LEAST32_T@
466 # ifndef INT_LEAST32_MIN
467 # define INT_LEAST32_MIN (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1))
470 # define INT_LEAST32_MIN INT32_MIN
472 #if @HAVE_INT_LEAST32_T@
473 # ifndef INT_LEAST32_MAX
474 # define INT_LEAST32_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1)))
477 # define INT_LEAST32_MAX INT32_MAX
479 #if @HAVE_UINT_LEAST32_T@
480 # ifndef UINT_LEAST32_MAX
481 # if @BITSIZEOF_UINT_LEAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
482 # define UINT_LEAST32_MAX (((1 << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
484 # define UINT_LEAST32_MAX (((1U << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
488 # define UINT_LEAST32_MAX UINT32_MAX
491 #if @HAVE_INT_LEAST64_T@
492 # ifndef INT_LEAST64_MIN
493 # if @HAVE_LONG_64BIT@
494 # define INT_LEAST64_MIN (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1))
495 # elif @HAVE_LONG_LONG_64BIT@
496 # define INT_LEAST64_MIN (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1))
497 # elif defined _MSC_VER
498 # define INT_LEAST64_MIN (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1))
502 # ifdef _STDINT_H_HAVE_INT64
503 # define INT_LEAST64_MIN INT64_MIN
506 #if @HAVE_INT_LEAST64_T@
507 # ifndef INT_LEAST64_MAX
508 # if @HAVE_LONG_64BIT@
509 # define INT_LEAST64_MAX (~ (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
510 # elif @HAVE_LONG_LONG_64BIT@
511 # define INT_LEAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
512 # elif defined _MSC_VER
513 # define INT_LEAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
517 # ifdef _STDINT_H_HAVE_INT64
518 # define INT_LEAST64_MAX INT64_MAX
521 #if @HAVE_UINT_LEAST64_T@
522 # ifndef UINT_LEAST64_MAX
523 # if @HAVE_LONG_64BIT@
524 # define UINT_LEAST64_MAX (((1UL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
525 # elif @HAVE_LONG_LONG_64BIT@
526 # define UINT_LEAST64_MAX (((1ULL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
527 # elif defined _MSC_VER
528 # define UINT_LEAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
532 # ifdef _STDINT_H_HAVE_UINT64
533 # define UINT_LEAST64_MAX UINT64_MAX
537 /* 7.18.2.3. Limits of fastest minimum-width integer types */
539 /* Here we assume a standard architecture where the hardware integer
540 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
541 are taken from the same list of types. */
543 #if @HAVE_INT_FAST8_T@
544 # ifndef INT_FAST8_MIN
545 # define INT_FAST8_MIN (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1))
548 # if _STDINT_H_INT64_FASTER_THAN_INT32
549 # define INT_FAST8_MIN INT64_MIN
551 # define INT_FAST8_MIN INT32_MIN
554 #if @HAVE_INT_FAST8_T@
555 # ifndef INT_FAST8_MAX
556 # define INT_FAST8_MAX (~ (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1)))
559 # if _STDINT_H_INT64_FASTER_THAN_INT32
560 # define INT_FAST8_MAX INT64_MAX
562 # define INT_FAST8_MAX INT32_MAX
565 #if @HAVE_UINT_FAST8_T@
566 # ifndef UINT_FAST8_MAX
567 # if @BITSIZEOF_UINT_FAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
568 # define UINT_FAST8_MAX (((1 << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
570 # define UINT_FAST8_MAX (((1UL << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
574 # if _STDINT_H_INT64_FASTER_THAN_INT32
575 # define UINT_FAST8_MAX UINT64_MAX
577 # define UINT_FAST8_MAX UINT32_MAX
581 #if @HAVE_INT_FAST16_T@
582 # ifndef INT_FAST16_MIN
583 # define INT_FAST16_MIN (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1))
586 # if _STDINT_H_INT64_FASTER_THAN_INT32
587 # define INT_FAST16_MIN INT64_MIN
589 # define INT_FAST16_MIN INT32_MIN
592 #if @HAVE_INT_FAST16_T@
593 # ifndef INT_FAST16_MAX
594 # define INT_FAST16_MAX (~ (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1)))
597 # if _STDINT_H_INT64_FASTER_THAN_INT32
598 # define INT_FAST16_MAX INT64_MAX
600 # define INT_FAST16_MAX INT32_MAX
603 #if @HAVE_UINT_FAST16_T@
604 # ifndef UINT_FAST16_MAX
605 # if @BITSIZEOF_UINT_FAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
606 # define UINT_FAST16_MAX (((1 << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
608 # define UINT_FAST16_MAX (((1UL << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
612 # if _STDINT_H_INT64_FASTER_THAN_INT32
613 # define UINT_FAST16_MAX UINT64_MAX
615 # define UINT_FAST16_MAX UINT32_MAX
619 #if @HAVE_INT_FAST32_T@
620 # ifndef INT_FAST32_MIN
621 # define INT_FAST32_MIN (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1))
624 # if _STDINT_H_INT64_FASTER_THAN_INT32
625 # define INT_FAST32_MIN INT64_MIN
627 # define INT_FAST32_MIN INT32_MIN
630 #if @HAVE_INT_FAST32_T@
631 # ifndef INT_FAST32_MAX
632 # define INT_FAST32_MAX (~ (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1)))
635 # if _STDINT_H_INT64_FASTER_THAN_INT32
636 # define INT_FAST32_MAX INT64_MAX
638 # define INT_FAST32_MAX INT32_MAX
641 #if @HAVE_UINT_FAST32_T@
642 # ifndef UINT_FAST32_MAX
643 # if @BITSIZEOF_UINT_FAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
644 # define UINT_FAST32_MAX (((1 << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
646 # define UINT_FAST32_MAX (((1UL << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
650 # if _STDINT_H_INT64_FASTER_THAN_INT32
651 # define UINT_FAST32_MAX UINT64_MAX
653 # define UINT_FAST32_MAX UINT32_MAX
657 #if @HAVE_INT_FAST64_T@
658 # ifndef INT_FAST64_MIN
659 # if @HAVE_LONG_64BIT@
660 # define INT_FAST64_MIN (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1))
661 # elif @HAVE_LONG_LONG_64BIT@
662 # define INT_FAST64_MIN (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1))
663 # elif defined _MSC_VER
664 # define INT_FAST64_MIN (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1))
668 # ifdef _STDINT_H_HAVE_INT64
669 # define INT_FAST64_MIN INT64_MIN
672 #if @HAVE_INT_FAST64_T@
673 # ifndef INT_FAST64_MAX
674 # if @HAVE_LONG_64BIT@
675 # define INT_FAST64_MAX (~ (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1)))
676 # elif @HAVE_LONG_LONG_64BIT@
677 # define INT_FAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1)))
678 # elif defined _MSC_VER
679 # define INT_FAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1)))
683 # ifdef _STDINT_H_HAVE_INT64
684 # define INT_FAST64_MAX INT64_MAX
687 #if @HAVE_UINT_FAST64_T@
688 # ifndef UINT_FAST64_MAX
689 # if @HAVE_LONG_64BIT@
690 # define UINT_FAST64_MAX (((1UL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
691 # elif @HAVE_LONG_LONG_64BIT@
692 # define UINT_FAST64_MAX (((1ULL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
693 # elif defined _MSC_VER
694 # define UINT_FAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
698 # ifdef _STDINT_H_HAVE_UINT64
699 # define UINT_FAST64_MAX UINT64_MAX
703 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
707 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
708 # define INTPTR_MIN (-1LL << (@BITSIZEOF_INTPTR_T@ - 1))
710 # define INTPTR_MIN (-1L << (@BITSIZEOF_INTPTR_T@ - 1))
714 # define INTPTR_MIN LONG_MIN
718 # if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
719 # define INTPTR_MAX (~ (-1LL << (@BITSIZEOF_INTPTR_T@ - 1)))
721 # define INTPTR_MAX (~ (-1L << (@BITSIZEOF_INTPTR_T@ - 1)))
725 # define INTPTR_MAX LONG_MAX
729 # if @BITSIZEOF_UINTPTR_T@ > @BITSIZEOF_UNSIGNED_LONG@
730 # define UINTPTR_MAX (((1ULL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
732 # define UINTPTR_MAX (((1UL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
736 # define UINTPTR_MAX ULONG_MAX
739 /* 7.18.2.5. Limits of greatest-width integer types */
743 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
744 # define INTMAX_MIN (-1LL << (@BITSIZEOF_INTMAX_T@ - 1))
746 # define INTMAX_MIN (-1L << (@BITSIZEOF_INTMAX_T@ - 1))
750 # ifdef _STDINT_H_HAVE_INT64
751 # define INTMAX_MIN INT64_MIN
753 # define INTMAX_MIN INT32_MIN
758 # if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
759 # define INTMAX_MAX (~ (-1LL << (@BITSIZEOF_INTMAX_T@ - 1)))
761 # define INTMAX_MAX (~ (-1L << (@BITSIZEOF_INTMAX_T@ - 1)))
765 # ifdef _STDINT_H_HAVE_INT64
766 # define INTMAX_MAX INT64_MAX
768 # define INTMAX_MAX INT32_MAX
773 # if @BITSIZEOF_UINTMAX_T@ > @BITSIZEOF_UNSIGNED_LONG@
774 # define UINTMAX_MAX (((1ULL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
776 # define UINTMAX_MAX (((1UL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
780 # ifdef _STDINT_H_HAVE_INT64
781 # define UINTMAX_MAX UINT64_MAX
783 # define UINTMAX_MAX UINT32_MAX
787 /* 7.18.3. Limits of other integer types */
789 /* ptrdiff_t limits */
791 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
792 # define PTRDIFF_MIN (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1))
794 # define PTRDIFF_MIN (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1))
798 # if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
799 # define PTRDIFF_MAX (~ (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1)))
801 # define PTRDIFF_MAX (~ (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1)))
805 /* sig_atomic_t limits */
806 #ifndef SIG_ATOMIC_MIN
807 # if @HAVE_SIGNED_SIG_ATOMIC_T@
808 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
809 # define SIG_ATOMIC_MIN (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
811 # define SIG_ATOMIC_MIN (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
814 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
815 # define SIG_ATOMIC_MIN 0UL
816 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
817 # define SIG_ATOMIC_MIN 0U
819 # define SIG_ATOMIC_MIN 0
823 #ifndef SIG_ATOMIC_MAX
824 # if @HAVE_SIGNED_SIG_ATOMIC_T@
825 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
826 # define SIG_ATOMIC_MAX (~ (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
828 # define SIG_ATOMIC_MAX (~ (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
831 # if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
832 # define SIG_ATOMIC_MAX (((1UL << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
833 # elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
834 # define SIG_ATOMIC_MAX (((1U << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
836 # define SIG_ATOMIC_MAX (((1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
842 #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
843 # if @BITSIZEOF_SIZE_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIZE_T_UNSIGNED_LONG@
844 # define SIZE_MAX (((1UL << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
846 # define SIZE_MAX (((1U << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
850 /* wchar_t limits may already be defined in <stddef.h>. */
852 # if @HAVE_SIGNED_WCHAR_T@
853 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
854 # define WCHAR_MIN (-1L << (@BITSIZEOF_WCHAR_T@ - 1))
856 # define WCHAR_MIN (-1 << (@BITSIZEOF_WCHAR_T@ - 1))
859 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
860 # define WCHAR_MIN 0UL
861 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
862 # define WCHAR_MIN 0U
869 # if @HAVE_SIGNED_WCHAR_T@
870 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
871 # define WCHAR_MAX (~ (-1L << (@BITSIZEOF_WCHAR_T@ - 1)))
873 # define WCHAR_MAX (~ (-1 << (@BITSIZEOF_WCHAR_T@ - 1)))
876 # if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
877 # define WCHAR_MAX (((1UL << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
878 # elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
879 # define WCHAR_MAX (((1U << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
881 # define WCHAR_MAX (((1 << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
888 # if @HAVE_SIGNED_WINT_T@
889 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
890 # define WINT_MIN (-1L << (@BITSIZEOF_WINT_T@ - 1))
892 # define WINT_MIN (-1 << (@BITSIZEOF_WINT_T@ - 1))
895 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
896 # define WINT_MIN 0UL
897 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
905 # if @HAVE_SIGNED_WINT_T@
906 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
907 # define WINT_MAX (~ (-1L << (@BITSIZEOF_WINT_T@ - 1)))
909 # define WINT_MAX (~ (-1 << (@BITSIZEOF_WINT_T@ - 1)))
912 # if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
913 # define WINT_MAX (((1UL << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
914 # elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
915 # define WINT_MAX (((1U << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
917 # define WINT_MAX (((1 << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
924 /* 7.18.4. Macros for integer constants */
926 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
928 /* 7.18.4.1. Macros for minimum-width integer constants */
929 /* According to ISO C 99 Technical Corrigendum 1 */
935 # if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
936 # define UINT8_C(x) x
938 # define UINT8_C(x) x##U
941 # define UINT8_C(x) x
948 # if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
949 # define UINT16_C(x) x
951 # define UINT16_C(x) x##U
954 # define UINT16_C(x) x
961 # if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
962 # define UINT32_C(x) x
964 # define UINT32_C(x) x##U
967 # define UINT32_C(x) x
972 #if @HAVE_LONG_64BIT@
973 # define INT64_C(x) x##L
974 # define UINT64_C(x) x##UL
975 #elif @HAVE_LONG_LONG_64BIT@
976 # define INT64_C(x) x##LL
977 # define UINT64_C(x) x##ULL
978 #elif defined(_MSC_VER)
979 # define INT64_C(x) x##i64
980 # define UINT64_C(x) x##ui64
983 /* 7.18.4.2. Macros for greatest-width integer constants */
987 #if @HAVE_LONG_64BIT@
988 # define INTMAX_C(x) x##L
989 # define UINTMAX_C(x) x##UL
990 #elif @HAVE_LONG_LONG_64BIT@
991 # define INTMAX_C(x) x##LL
992 # define UINTMAX_C(x) x##ULL
993 #elif defined(_MSC_VER)
994 # define INTMAX_C(x) x##i64
995 # define UINTMAX_C(x) x##ui64
997 # define INTMAX_C(x) x
998 # define UINTMAX_C(x) x##U
1003 #endif /* _STDINT_H */