Merge from origin/emacs-25
[emacs.git] / lib / stdint.in.h
blobc86ab096289ac8629ba60ee4c207d9398dcc628d
1 /* Copyright (C) 2001-2002, 2004-2016 Free Software Foundation, Inc.
2 Written by Paul Eggert, 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 3, or (at your option)
8 any later version.
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, see <http://www.gnu.org/licenses/>. */
19 * ISO C 99 <stdint.h> for platforms that lack it.
20 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
23 #ifndef _@GUARD_PREFIX@_STDINT_H
25 #if __GNUC__ >= 3
26 @PRAGMA_SYSTEM_HEADER@
27 #endif
28 @PRAGMA_COLUMNS@
30 /* When including a system file that in turn includes <inttypes.h>,
31 use the system <inttypes.h>, not our substitute. This avoids
32 problems with (for example) VMS, whose <sys/bitypes.h> includes
33 <inttypes.h>. */
34 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
36 /* On Android (Bionic libc), <sys/types.h> includes this file before
37 having defined 'time_t'. Therefore in this case avoid including
38 other system header files; just include the system's <stdint.h>.
39 Ideally we should test __BIONIC__ here, but it is only defined after
40 <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
41 #if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
42 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
43 #else
45 /* Get those types that are already defined in other system include
46 files, so that we can "#define int8_t signed char" below without
47 worrying about a later system include file containing a "typedef
48 signed char int8_t;" that will get messed up by our macro. Our
49 macros should all be consistent with the system versions, except
50 for the "fast" types and macros, which we recommend against using
51 in public interfaces due to compiler differences. */
53 #if @HAVE_STDINT_H@
54 # if defined __sgi && ! defined __c99
55 /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
56 with "This header file is to be used only for c99 mode compilations"
57 diagnostics. */
58 # define __STDINT_H__
59 # endif
61 /* Some pre-C++11 <stdint.h> implementations need this. */
62 # ifdef __cplusplus
63 # ifndef __STDC_CONSTANT_MACROS
64 # define __STDC_CONSTANT_MACROS 1
65 # endif
66 # ifndef __STDC_LIMIT_MACROS
67 # define __STDC_LIMIT_MACROS 1
68 # endif
69 # endif
71 /* Other systems may have an incomplete or buggy <stdint.h>.
72 Include it before <inttypes.h>, since any "#include <stdint.h>"
73 in <inttypes.h> would reinclude us, skipping our contents because
74 _@GUARD_PREFIX@_STDINT_H is defined.
75 The include_next requires a split double-inclusion guard. */
76 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
77 #endif
79 #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
80 #define _@GUARD_PREFIX@_STDINT_H
82 /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
83 LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */
84 #include <limits.h>
86 #if ! @HAVE_C99_STDINT_H@
88 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
89 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
90 AIX 5.2 <sys/types.h> isn't needed and causes troubles.
91 Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
92 relies on the system <stdint.h> definitions, so include
93 <sys/types.h> after @NEXT_STDINT_H@. */
94 # if @HAVE_SYS_TYPES_H@ && ! defined _AIX
95 # include <sys/types.h>
96 # endif
98 # if @HAVE_INTTYPES_H@
99 /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
100 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
101 <inttypes.h> also defines intptr_t and uintptr_t. */
102 # include <inttypes.h>
103 # elif @HAVE_SYS_INTTYPES_H@
104 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
105 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
106 # include <sys/inttypes.h>
107 # endif
109 # if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
110 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
111 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
112 included by <sys/types.h>. */
113 # include <sys/bitypes.h>
114 # endif
116 # undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
118 /* Minimum and maximum values for an integer type under the usual assumption.
119 Return an unspecified value if BITS == 0, adding a check to pacify
120 picky compilers. */
122 # define _STDINT_MIN(signed, bits, zero) \
123 ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
125 # define _STDINT_MAX(signed, bits, zero) \
126 (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
128 #if !GNULIB_defined_stdint_types
130 /* 7.18.1.1. Exact-width integer types */
132 /* Here we assume a standard architecture where the hardware integer
133 types have 8, 16, 32, optionally 64 bits. */
135 # undef int8_t
136 # undef uint8_t
137 typedef signed char gl_int8_t;
138 typedef unsigned char gl_uint8_t;
139 # define int8_t gl_int8_t
140 # define uint8_t gl_uint8_t
142 # undef int16_t
143 # undef uint16_t
144 typedef short int gl_int16_t;
145 typedef unsigned short int gl_uint16_t;
146 # define int16_t gl_int16_t
147 # define uint16_t gl_uint16_t
149 # undef int32_t
150 # undef uint32_t
151 typedef int gl_int32_t;
152 typedef unsigned int gl_uint32_t;
153 # define int32_t gl_int32_t
154 # define uint32_t gl_uint32_t
156 /* If the system defines INT64_MAX, assume int64_t works. That way,
157 if the underlying platform defines int64_t to be a 64-bit long long
158 int, the code below won't mistakenly define it to be a 64-bit long
159 int, which would mess up C++ name mangling. We must use #ifdef
160 rather than #if, to avoid an error with HP-UX 10.20 cc. */
162 # ifdef INT64_MAX
163 # define GL_INT64_T
164 # else
165 /* Do not undefine int64_t if gnulib is not being used with 64-bit
166 types, since otherwise it breaks platforms like Tandem/NSK. */
167 # if LONG_MAX >> 31 >> 31 == 1
168 # undef int64_t
169 typedef long int gl_int64_t;
170 # define int64_t gl_int64_t
171 # define GL_INT64_T
172 # elif defined _MSC_VER
173 # undef int64_t
174 typedef __int64 gl_int64_t;
175 # define int64_t gl_int64_t
176 # define GL_INT64_T
177 # elif @HAVE_LONG_LONG_INT@
178 # undef int64_t
179 typedef long long int gl_int64_t;
180 # define int64_t gl_int64_t
181 # define GL_INT64_T
182 # endif
183 # endif
185 # ifdef UINT64_MAX
186 # define GL_UINT64_T
187 # else
188 # if ULONG_MAX >> 31 >> 31 >> 1 == 1
189 # undef uint64_t
190 typedef unsigned long int gl_uint64_t;
191 # define uint64_t gl_uint64_t
192 # define GL_UINT64_T
193 # elif defined _MSC_VER
194 # undef uint64_t
195 typedef unsigned __int64 gl_uint64_t;
196 # define uint64_t gl_uint64_t
197 # define GL_UINT64_T
198 # elif @HAVE_UNSIGNED_LONG_LONG_INT@
199 # undef uint64_t
200 typedef unsigned long long int gl_uint64_t;
201 # define uint64_t gl_uint64_t
202 # define GL_UINT64_T
203 # endif
204 # endif
206 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
207 # define _UINT8_T
208 # define _UINT32_T
209 # define _UINT64_T
212 /* 7.18.1.2. Minimum-width integer types */
214 /* Here we assume a standard architecture where the hardware integer
215 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
216 are the same as the corresponding N_t types. */
218 # undef int_least8_t
219 # undef uint_least8_t
220 # undef int_least16_t
221 # undef uint_least16_t
222 # undef int_least32_t
223 # undef uint_least32_t
224 # undef int_least64_t
225 # undef uint_least64_t
226 # define int_least8_t int8_t
227 # define uint_least8_t uint8_t
228 # define int_least16_t int16_t
229 # define uint_least16_t uint16_t
230 # define int_least32_t int32_t
231 # define uint_least32_t uint32_t
232 # ifdef GL_INT64_T
233 # define int_least64_t int64_t
234 # endif
235 # ifdef GL_UINT64_T
236 # define uint_least64_t uint64_t
237 # endif
239 /* 7.18.1.3. Fastest minimum-width integer types */
241 /* Note: Other <stdint.h> substitutes may define these types differently.
242 It is not recommended to use these types in public header files. */
244 /* Here we assume a standard architecture where the hardware integer
245 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
246 are taken from the same list of types. The following code normally
247 uses types consistent with glibc, as that lessens the chance of
248 incompatibility with older GNU hosts. */
250 # undef int_fast8_t
251 # undef uint_fast8_t
252 # undef int_fast16_t
253 # undef uint_fast16_t
254 # undef int_fast32_t
255 # undef uint_fast32_t
256 # undef int_fast64_t
257 # undef uint_fast64_t
258 typedef signed char gl_int_fast8_t;
259 typedef unsigned char gl_uint_fast8_t;
261 # ifdef __sun
262 /* Define types compatible with SunOS 5.10, so that code compiled under
263 earlier SunOS versions works with code compiled under SunOS 5.10. */
264 typedef int gl_int_fast32_t;
265 typedef unsigned int gl_uint_fast32_t;
266 # else
267 typedef long int gl_int_fast32_t;
268 typedef unsigned long int gl_uint_fast32_t;
269 # endif
270 typedef gl_int_fast32_t gl_int_fast16_t;
271 typedef gl_uint_fast32_t gl_uint_fast16_t;
273 # define int_fast8_t gl_int_fast8_t
274 # define uint_fast8_t gl_uint_fast8_t
275 # define int_fast16_t gl_int_fast16_t
276 # define uint_fast16_t gl_uint_fast16_t
277 # define int_fast32_t gl_int_fast32_t
278 # define uint_fast32_t gl_uint_fast32_t
279 # ifdef GL_INT64_T
280 # define int_fast64_t int64_t
281 # endif
282 # ifdef GL_UINT64_T
283 # define uint_fast64_t uint64_t
284 # endif
286 /* 7.18.1.4. Integer types capable of holding object pointers */
288 /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
289 definitions of intptr_t and uintptr_t (which use int and unsigned)
290 to avoid clashes with declarations of system functions like sbrk. */
291 # ifndef _INTPTR_T_DECLARED
292 # undef intptr_t
293 # undef uintptr_t
294 typedef long int gl_intptr_t;
295 typedef unsigned long int gl_uintptr_t;
296 # define intptr_t gl_intptr_t
297 # define uintptr_t gl_uintptr_t
298 # endif
300 /* 7.18.1.5. Greatest-width integer types */
302 /* Note: These types are compiler dependent. It may be unwise to use them in
303 public header files. */
305 /* If the system defines INTMAX_MAX, assume that intmax_t works, and
306 similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
307 assuming one type where another is used by the system. */
309 # ifndef INTMAX_MAX
310 # undef INTMAX_C
311 # undef intmax_t
312 # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
313 typedef long long int gl_intmax_t;
314 # define intmax_t gl_intmax_t
315 # elif defined GL_INT64_T
316 # define intmax_t int64_t
317 # else
318 typedef long int gl_intmax_t;
319 # define intmax_t gl_intmax_t
320 # endif
321 # endif
323 # ifndef UINTMAX_MAX
324 # undef UINTMAX_C
325 # undef uintmax_t
326 # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
327 typedef unsigned long long int gl_uintmax_t;
328 # define uintmax_t gl_uintmax_t
329 # elif defined GL_UINT64_T
330 # define uintmax_t uint64_t
331 # else
332 typedef unsigned long int gl_uintmax_t;
333 # define uintmax_t gl_uintmax_t
334 # endif
335 # endif
337 /* Verify that intmax_t and uintmax_t have the same size. Too much code
338 breaks if this is not the case. If this check fails, the reason is likely
339 to be found in the autoconf macros. */
340 typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
341 ? 1 : -1];
343 # define GNULIB_defined_stdint_types 1
344 # endif /* !GNULIB_defined_stdint_types */
346 /* 7.18.2. Limits of specified-width integer types */
348 /* 7.18.2.1. Limits of exact-width integer types */
350 /* Here we assume a standard architecture where the hardware integer
351 types have 8, 16, 32, optionally 64 bits. */
353 # undef INT8_MIN
354 # undef INT8_MAX
355 # undef UINT8_MAX
356 # define INT8_MIN (~ INT8_MAX)
357 # define INT8_MAX 127
358 # define UINT8_MAX 255
360 # undef INT16_MIN
361 # undef INT16_MAX
362 # undef UINT16_MAX
363 # define INT16_MIN (~ INT16_MAX)
364 # define INT16_MAX 32767
365 # define UINT16_MAX 65535
367 # undef INT32_MIN
368 # undef INT32_MAX
369 # undef UINT32_MAX
370 # define INT32_MIN (~ INT32_MAX)
371 # define INT32_MAX 2147483647
372 # define UINT32_MAX 4294967295U
374 # if defined GL_INT64_T && ! defined INT64_MAX
375 /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
376 evaluates the latter incorrectly in preprocessor expressions. */
377 # define INT64_MIN (- INTMAX_C (1) << 63)
378 # define INT64_MAX INTMAX_C (9223372036854775807)
379 # endif
381 # if defined GL_UINT64_T && ! defined UINT64_MAX
382 # define UINT64_MAX UINTMAX_C (18446744073709551615)
383 # endif
385 /* 7.18.2.2. Limits of minimum-width integer types */
387 /* Here we assume a standard architecture where the hardware integer
388 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
389 are the same as the corresponding N_t types. */
391 # undef INT_LEAST8_MIN
392 # undef INT_LEAST8_MAX
393 # undef UINT_LEAST8_MAX
394 # define INT_LEAST8_MIN INT8_MIN
395 # define INT_LEAST8_MAX INT8_MAX
396 # define UINT_LEAST8_MAX UINT8_MAX
398 # undef INT_LEAST16_MIN
399 # undef INT_LEAST16_MAX
400 # undef UINT_LEAST16_MAX
401 # define INT_LEAST16_MIN INT16_MIN
402 # define INT_LEAST16_MAX INT16_MAX
403 # define UINT_LEAST16_MAX UINT16_MAX
405 # undef INT_LEAST32_MIN
406 # undef INT_LEAST32_MAX
407 # undef UINT_LEAST32_MAX
408 # define INT_LEAST32_MIN INT32_MIN
409 # define INT_LEAST32_MAX INT32_MAX
410 # define UINT_LEAST32_MAX UINT32_MAX
412 # undef INT_LEAST64_MIN
413 # undef INT_LEAST64_MAX
414 # ifdef GL_INT64_T
415 # define INT_LEAST64_MIN INT64_MIN
416 # define INT_LEAST64_MAX INT64_MAX
417 # endif
419 # undef UINT_LEAST64_MAX
420 # ifdef GL_UINT64_T
421 # define UINT_LEAST64_MAX UINT64_MAX
422 # endif
424 /* 7.18.2.3. Limits of fastest minimum-width integer types */
426 /* Here we assume a standard architecture where the hardware integer
427 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
428 are taken from the same list of types. */
430 # undef INT_FAST8_MIN
431 # undef INT_FAST8_MAX
432 # undef UINT_FAST8_MAX
433 # define INT_FAST8_MIN SCHAR_MIN
434 # define INT_FAST8_MAX SCHAR_MAX
435 # define UINT_FAST8_MAX UCHAR_MAX
437 # undef INT_FAST16_MIN
438 # undef INT_FAST16_MAX
439 # undef UINT_FAST16_MAX
440 # define INT_FAST16_MIN INT_FAST32_MIN
441 # define INT_FAST16_MAX INT_FAST32_MAX
442 # define UINT_FAST16_MAX UINT_FAST32_MAX
444 # undef INT_FAST32_MIN
445 # undef INT_FAST32_MAX
446 # undef UINT_FAST32_MAX
447 # ifdef __sun
448 # define INT_FAST32_MIN INT_MIN
449 # define INT_FAST32_MAX INT_MAX
450 # define UINT_FAST32_MAX UINT_MAX
451 # else
452 # define INT_FAST32_MIN LONG_MIN
453 # define INT_FAST32_MAX LONG_MAX
454 # define UINT_FAST32_MAX ULONG_MAX
455 # endif
457 # undef INT_FAST64_MIN
458 # undef INT_FAST64_MAX
459 # ifdef GL_INT64_T
460 # define INT_FAST64_MIN INT64_MIN
461 # define INT_FAST64_MAX INT64_MAX
462 # endif
464 # undef UINT_FAST64_MAX
465 # ifdef GL_UINT64_T
466 # define UINT_FAST64_MAX UINT64_MAX
467 # endif
469 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
471 # undef INTPTR_MIN
472 # undef INTPTR_MAX
473 # undef UINTPTR_MAX
474 # define INTPTR_MIN LONG_MIN
475 # define INTPTR_MAX LONG_MAX
476 # define UINTPTR_MAX ULONG_MAX
478 /* 7.18.2.5. Limits of greatest-width integer types */
480 # ifndef INTMAX_MAX
481 # undef INTMAX_MIN
482 # ifdef INT64_MAX
483 # define INTMAX_MIN INT64_MIN
484 # define INTMAX_MAX INT64_MAX
485 # else
486 # define INTMAX_MIN INT32_MIN
487 # define INTMAX_MAX INT32_MAX
488 # endif
489 # endif
491 # ifndef UINTMAX_MAX
492 # ifdef UINT64_MAX
493 # define UINTMAX_MAX UINT64_MAX
494 # else
495 # define UINTMAX_MAX UINT32_MAX
496 # endif
497 # endif
499 /* 7.18.3. Limits of other integer types */
501 /* ptrdiff_t limits */
502 # undef PTRDIFF_MIN
503 # undef PTRDIFF_MAX
504 # if @APPLE_UNIVERSAL_BUILD@
505 # ifdef _LP64
506 # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
507 # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
508 # else
509 # define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
510 # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
511 # endif
512 # else
513 # define PTRDIFF_MIN \
514 _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
515 # define PTRDIFF_MAX \
516 _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
517 # endif
519 /* sig_atomic_t limits */
520 # undef SIG_ATOMIC_MIN
521 # undef SIG_ATOMIC_MAX
522 # define SIG_ATOMIC_MIN \
523 _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
524 0@SIG_ATOMIC_T_SUFFIX@)
525 # define SIG_ATOMIC_MAX \
526 _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
527 0@SIG_ATOMIC_T_SUFFIX@)
530 /* size_t limit */
531 # undef SIZE_MAX
532 # if @APPLE_UNIVERSAL_BUILD@
533 # ifdef _LP64
534 # define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
535 # else
536 # define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
537 # endif
538 # else
539 # define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
540 # endif
542 /* wchar_t limits */
543 /* Get WCHAR_MIN, WCHAR_MAX.
544 This include is not on the top, above, because on OSF/1 4.0 we have a
545 sequence of nested includes
546 <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
547 <stdint.h> and assumes its types are already defined. */
548 # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
549 /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
550 included before <wchar.h>. */
551 # include <stddef.h>
552 # include <stdio.h>
553 # include <time.h>
554 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
555 # include <wchar.h>
556 # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
557 # endif
558 # undef WCHAR_MIN
559 # undef WCHAR_MAX
560 # define WCHAR_MIN \
561 _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
562 # define WCHAR_MAX \
563 _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
565 /* wint_t limits */
566 # undef WINT_MIN
567 # undef WINT_MAX
568 # define WINT_MIN \
569 _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
570 # define WINT_MAX \
571 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
573 /* 7.18.4. Macros for integer constants */
575 /* 7.18.4.1. Macros for minimum-width integer constants */
576 /* According to ISO C 99 Technical Corrigendum 1 */
578 /* Here we assume a standard architecture where the hardware integer
579 types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
581 # undef INT8_C
582 # undef UINT8_C
583 # define INT8_C(x) x
584 # define UINT8_C(x) x
586 # undef INT16_C
587 # undef UINT16_C
588 # define INT16_C(x) x
589 # define UINT16_C(x) x
591 # undef INT32_C
592 # undef UINT32_C
593 # define INT32_C(x) x
594 # define UINT32_C(x) x ## U
596 # undef INT64_C
597 # undef UINT64_C
598 # if LONG_MAX >> 31 >> 31 == 1
599 # define INT64_C(x) x##L
600 # elif defined _MSC_VER
601 # define INT64_C(x) x##i64
602 # elif @HAVE_LONG_LONG_INT@
603 # define INT64_C(x) x##LL
604 # endif
605 # if ULONG_MAX >> 31 >> 31 >> 1 == 1
606 # define UINT64_C(x) x##UL
607 # elif defined _MSC_VER
608 # define UINT64_C(x) x##ui64
609 # elif @HAVE_UNSIGNED_LONG_LONG_INT@
610 # define UINT64_C(x) x##ULL
611 # endif
613 /* 7.18.4.2. Macros for greatest-width integer constants */
615 # ifndef INTMAX_C
616 # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
617 # define INTMAX_C(x) x##LL
618 # elif defined GL_INT64_T
619 # define INTMAX_C(x) INT64_C(x)
620 # else
621 # define INTMAX_C(x) x##L
622 # endif
623 # endif
625 # ifndef UINTMAX_C
626 # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
627 # define UINTMAX_C(x) x##ULL
628 # elif defined GL_UINT64_T
629 # define UINTMAX_C(x) UINT64_C(x)
630 # else
631 # define UINTMAX_C(x) x##UL
632 # endif
633 # endif
635 #endif /* !@HAVE_C99_STDINT_H@ */
637 /* Macros specified by ISO/IEC TS 18661-1:2014. */
639 #if (!defined UINTMAX_WIDTH \
640 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
641 # ifdef INT8_MAX
642 # define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
643 # endif
644 # ifdef UINT8_MAX
645 # define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
646 # endif
647 # ifdef INT16_MAX
648 # define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
649 # endif
650 # ifdef UINT16_MAX
651 # define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
652 # endif
653 # ifdef INT32_MAX
654 # define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
655 # endif
656 # ifdef UINT32_MAX
657 # define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
658 # endif
659 # ifdef INT64_MAX
660 # define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
661 # endif
662 # ifdef UINT64_MAX
663 # define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
664 # endif
665 # define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
666 # define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
667 # define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
668 # define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
669 # define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
670 # define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
671 # define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
672 # define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
673 # define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
674 # define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
675 # define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
676 # define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
677 # define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
678 # define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
679 # define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
680 # define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
681 # define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
682 # define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
683 # define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
684 # define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
685 # define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
686 # define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
687 # define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
688 # ifdef WINT_MAX
689 # define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
690 # endif
691 # ifdef SIG_ATOMIC_MAX
692 # define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
693 # endif
694 #endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
696 #endif /* _@GUARD_PREFIX@_STDINT_H */
697 #endif /* !(defined __ANDROID__ && ...) */
698 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */