1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* -*- buffer-read-only: t -*- vi: set ro: */
3/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
4#line 1
5/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
6   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
7   This file is part of gnulib.
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 3, or (at your option)
12   any later version.
13
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software Foundation,
21   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
22
23/*
24 * ISO C 99 <stdint.h> for platforms that lack it.
25 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
26 */
27
28#ifndef _GL_STDINT_H
29
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
35
36/* Get those types that are already defined in other system include
37   files, so that we can "#define int8_t signed char" below without
38   worrying about a later system include file containing a "typedef
39   signed char int8_t;" that will get messed up by our macro.  Our
40   macros should all be consistent with the system versions, except
41   for the "fast" types and macros, which we recommend against using
42   in public interfaces due to compiler differences.  */
43
44#if 1
45# if defined __sgi && ! defined __c99
46   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
47      with "This header file is to be used only for c99 mode compilations"
48      diagnostics.  */
49#  define __STDINT_H__
50# endif
51  /* Other systems may have an incomplete or buggy <stdint.h>.
52     Include it before <inttypes.h>, since any "#include <stdint.h>"
53     in <inttypes.h> would reinclude us, skipping our contents because
54     _GL_STDINT_H is defined.
55     The include_next requires a split double-inclusion guard.  */
56# if __GNUC__ >= 3
57#pragma GCC system_header
58# endif
59# include_next <stdint.h>
60#endif
61
62#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
63#define _GL_STDINT_H
64
65/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
66   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
67   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
68   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
69   relies on the system <stdint.h> definitions, so include
70   <sys/types.h> after <stdint.h>.  */
71#if 1 && ! defined _AIX
72# include <sys/types.h>
73#endif
74
75/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
76#include <limits.h>
77
78#if 1
79  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
80     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
81     <inttypes.h> also defines intptr_t and uintptr_t.  */
82# include <inttypes.h>
83#elif 0
84  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
85     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
86# include <sys/inttypes.h>
87#endif
88
89#if 0 && ! defined __BIT_TYPES_DEFINED__
90  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
91     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
92     included by <sys/types.h>.  */
93# include <sys/bitypes.h>
94#endif
95
96#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
97
98/* Minimum and maximum values for a integer type under the usual assumption.
99   Return an unspecified value if BITS == 0, adding a check to pacify
100   picky compilers.  */
101
102#define _STDINT_MIN(signed, bits, zero) \
103  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
104
105#define _STDINT_MAX(signed, bits, zero) \
106  ((signed) \
107   ? ~ _STDINT_MIN (signed, bits, zero) \
108   : /* The expression for the unsigned case.  The subtraction of (signed) \
109        is a nop in the unsigned case and avoids "signed integer overflow" \
110        warnings in the signed case.  */ \
111     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
112
113/* 7.18.1.1. Exact-width integer types */
114
115/* Here we assume a standard architecture where the hardware integer
116   types have 8, 16, 32, optionally 64 bits.  */
117
118#undef int8_t
119#undef uint8_t
120typedef signed char gl_int8_t;
121typedef unsigned char gl_uint8_t;
122#define int8_t gl_int8_t
123#define uint8_t gl_uint8_t
124
125#undef int16_t
126#undef uint16_t
127typedef short int gl_int16_t;
128typedef unsigned short int gl_uint16_t;
129#define int16_t gl_int16_t
130#define uint16_t gl_uint16_t
131
132#undef int32_t
133#undef uint32_t
134typedef int gl_int32_t;
135typedef unsigned int gl_uint32_t;
136#define int32_t gl_int32_t
137#define uint32_t gl_uint32_t
138
139/* Do not undefine int64_t if gnulib is not being used with 64-bit
140   types, since otherwise it breaks platforms like Tandem/NSK.  */
141#if LONG_MAX >> 31 >> 31 == 1
142# undef int64_t
143typedef long int gl_int64_t;
144# define int64_t gl_int64_t
145# define GL_INT64_T
146#elif defined _MSC_VER
147# undef int64_t
148typedef __int64 gl_int64_t;
149# define int64_t gl_int64_t
150# define GL_INT64_T
151#elif 1
152# undef int64_t
153typedef long long int gl_int64_t;
154# define int64_t gl_int64_t
155# define GL_INT64_T
156#endif
157
158#if ULONG_MAX >> 31 >> 31 >> 1 == 1
159# undef uint64_t
160typedef unsigned long int gl_uint64_t;
161# define uint64_t gl_uint64_t
162# define GL_UINT64_T
163#elif defined _MSC_VER
164# undef uint64_t
165typedef unsigned __int64 gl_uint64_t;
166# define uint64_t gl_uint64_t
167# define GL_UINT64_T
168#elif 1
169# undef uint64_t
170typedef unsigned long long int gl_uint64_t;
171# define uint64_t gl_uint64_t
172# define GL_UINT64_T
173#endif
174
175/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
176#define _UINT8_T
177#define _UINT32_T
178#define _UINT64_T
179
180
181/* 7.18.1.2. Minimum-width integer types */
182
183/* Here we assume a standard architecture where the hardware integer
184   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
185   are the same as the corresponding N_t types.  */
186
187#undef int_least8_t
188#undef uint_least8_t
189#undef int_least16_t
190#undef uint_least16_t
191#undef int_least32_t
192#undef uint_least32_t
193#undef int_least64_t
194#undef uint_least64_t
195#define int_least8_t int8_t
196#define uint_least8_t uint8_t
197#define int_least16_t int16_t
198#define uint_least16_t uint16_t
199#define int_least32_t int32_t
200#define uint_least32_t uint32_t
201#ifdef GL_INT64_T
202# define int_least64_t int64_t
203#endif
204#ifdef GL_UINT64_T
205# define uint_least64_t uint64_t
206#endif
207
208/* 7.18.1.3. Fastest minimum-width integer types */
209
210/* Note: Other <stdint.h> substitutes may define these types differently.
211   It is not recommended to use these types in public header files. */
212
213/* Here we assume a standard architecture where the hardware integer
214   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
215   are taken from the same list of types.  Assume that 'long int'
216   is fast enough for all narrower integers.  */
217
218#undef int_fast8_t
219#undef uint_fast8_t
220#undef int_fast16_t
221#undef uint_fast16_t
222#undef int_fast32_t
223#undef uint_fast32_t
224#undef int_fast64_t
225#undef uint_fast64_t
226typedef long int gl_int_fast8_t;
227typedef unsigned long int gl_uint_fast8_t;
228typedef long int gl_int_fast16_t;
229typedef unsigned long int gl_uint_fast16_t;
230typedef long int gl_int_fast32_t;
231typedef unsigned long int gl_uint_fast32_t;
232#define int_fast8_t gl_int_fast8_t
233#define uint_fast8_t gl_uint_fast8_t
234#define int_fast16_t gl_int_fast16_t
235#define uint_fast16_t gl_uint_fast16_t
236#define int_fast32_t gl_int_fast32_t
237#define uint_fast32_t gl_uint_fast32_t
238#ifdef GL_INT64_T
239# define int_fast64_t int64_t
240#endif
241#ifdef GL_UINT64_T
242# define uint_fast64_t uint64_t
243#endif
244
245/* 7.18.1.4. Integer types capable of holding object pointers */
246
247#undef intptr_t
248#undef uintptr_t
249typedef long int gl_intptr_t;
250typedef unsigned long int gl_uintptr_t;
251#define intptr_t gl_intptr_t
252#define uintptr_t gl_uintptr_t
253
254/* 7.18.1.5. Greatest-width integer types */
255
256/* Note: These types are compiler dependent. It may be unwise to use them in
257   public header files. */
258
259#undef intmax_t
260#if 1 && LONG_MAX >> 30 == 1
261typedef long long int gl_intmax_t;
262# define intmax_t gl_intmax_t
263#elif defined GL_INT64_T
264# define intmax_t int64_t
265#else
266typedef long int gl_intmax_t;
267# define intmax_t gl_intmax_t
268#endif
269
270#undef uintmax_t
271#if 1 && ULONG_MAX >> 31 == 1
272typedef unsigned long long int gl_uintmax_t;
273# define uintmax_t gl_uintmax_t
274#elif defined GL_UINT64_T
275# define uintmax_t uint64_t
276#else
277typedef unsigned long int gl_uintmax_t;
278# define uintmax_t gl_uintmax_t
279#endif
280
281/* Verify that intmax_t and uintmax_t have the same size.  Too much code
282   breaks if this is not the case.  If this check fails, the reason is likely
283   to be found in the autoconf macros.  */
284typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
285
286/* 7.18.2. Limits of specified-width integer types */
287
288#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
289
290/* 7.18.2.1. Limits of exact-width integer types */
291
292/* Here we assume a standard architecture where the hardware integer
293   types have 8, 16, 32, optionally 64 bits.  */
294
295#undef INT8_MIN
296#undef INT8_MAX
297#undef UINT8_MAX
298#define INT8_MIN  (~ INT8_MAX)
299#define INT8_MAX  127
300#define UINT8_MAX  255
301
302#undef INT16_MIN
303#undef INT16_MAX
304#undef UINT16_MAX
305#define INT16_MIN  (~ INT16_MAX)
306#define INT16_MAX  32767
307#define UINT16_MAX  65535
308
309#undef INT32_MIN
310#undef INT32_MAX
311#undef UINT32_MAX
312#define INT32_MIN  (~ INT32_MAX)
313#define INT32_MAX  2147483647
314#define UINT32_MAX  4294967295U
315
316#undef INT64_MIN
317#undef INT64_MAX
318#ifdef GL_INT64_T
319/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
320   evaluates the latter incorrectly in preprocessor expressions.  */
321# define INT64_MIN  (- INTMAX_C (1) << 63)
322# define INT64_MAX  INTMAX_C (9223372036854775807)
323#endif
324
325#undef UINT64_MAX
326#ifdef GL_UINT64_T
327# define UINT64_MAX  UINTMAX_C (18446744073709551615)
328#endif
329
330/* 7.18.2.2. Limits of minimum-width integer types */
331
332/* Here we assume a standard architecture where the hardware integer
333   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
334   are the same as the corresponding N_t types.  */
335
336#undef INT_LEAST8_MIN
337#undef INT_LEAST8_MAX
338#undef UINT_LEAST8_MAX
339#define INT_LEAST8_MIN  INT8_MIN
340#define INT_LEAST8_MAX  INT8_MAX
341#define UINT_LEAST8_MAX  UINT8_MAX
342
343#undef INT_LEAST16_MIN
344#undef INT_LEAST16_MAX
345#undef UINT_LEAST16_MAX
346#define INT_LEAST16_MIN  INT16_MIN
347#define INT_LEAST16_MAX  INT16_MAX
348#define UINT_LEAST16_MAX  UINT16_MAX
349
350#undef INT_LEAST32_MIN
351#undef INT_LEAST32_MAX
352#undef UINT_LEAST32_MAX
353#define INT_LEAST32_MIN  INT32_MIN
354#define INT_LEAST32_MAX  INT32_MAX
355#define UINT_LEAST32_MAX  UINT32_MAX
356
357#undef INT_LEAST64_MIN
358#undef INT_LEAST64_MAX
359#ifdef GL_INT64_T
360# define INT_LEAST64_MIN  INT64_MIN
361# define INT_LEAST64_MAX  INT64_MAX
362#endif
363
364#undef UINT_LEAST64_MAX
365#ifdef GL_UINT64_T
366# define UINT_LEAST64_MAX  UINT64_MAX
367#endif
368
369/* 7.18.2.3. Limits of fastest minimum-width integer types */
370
371/* Here we assume a standard architecture where the hardware integer
372   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
373   are taken from the same list of types.  */
374
375#undef INT_FAST8_MIN
376#undef INT_FAST8_MAX
377#undef UINT_FAST8_MAX
378#define INT_FAST8_MIN  LONG_MIN
379#define INT_FAST8_MAX  LONG_MAX
380#define UINT_FAST8_MAX  ULONG_MAX
381
382#undef INT_FAST16_MIN
383#undef INT_FAST16_MAX
384#undef UINT_FAST16_MAX
385#define INT_FAST16_MIN  LONG_MIN
386#define INT_FAST16_MAX  LONG_MAX
387#define UINT_FAST16_MAX  ULONG_MAX
388
389#undef INT_FAST32_MIN
390#undef INT_FAST32_MAX
391#undef UINT_FAST32_MAX
392#define INT_FAST32_MIN  LONG_MIN
393#define INT_FAST32_MAX  LONG_MAX
394#define UINT_FAST32_MAX  ULONG_MAX
395
396#undef INT_FAST64_MIN
397#undef INT_FAST64_MAX
398#ifdef GL_INT64_T
399# define INT_FAST64_MIN  INT64_MIN
400# define INT_FAST64_MAX  INT64_MAX
401#endif
402
403#undef UINT_FAST64_MAX
404#ifdef GL_UINT64_T
405# define UINT_FAST64_MAX  UINT64_MAX
406#endif
407
408/* 7.18.2.4. Limits of integer types capable of holding object pointers */
409
410#undef INTPTR_MIN
411#undef INTPTR_MAX
412#undef UINTPTR_MAX
413#define INTPTR_MIN  LONG_MIN
414#define INTPTR_MAX  LONG_MAX
415#define UINTPTR_MAX  ULONG_MAX
416
417/* 7.18.2.5. Limits of greatest-width integer types */
418
419#undef INTMAX_MIN
420#undef INTMAX_MAX
421#ifdef INT64_MAX
422# define INTMAX_MIN  INT64_MIN
423# define INTMAX_MAX  INT64_MAX
424#else
425# define INTMAX_MIN  INT32_MIN
426# define INTMAX_MAX  INT32_MAX
427#endif
428
429#undef UINTMAX_MAX
430#ifdef UINT64_MAX
431# define UINTMAX_MAX  UINT64_MAX
432#else
433# define UINTMAX_MAX  UINT32_MAX
434#endif
435
436/* 7.18.3. Limits of other integer types */
437
438/* ptrdiff_t limits */
439#undef PTRDIFF_MIN
440#undef PTRDIFF_MAX
441#if 0
442# ifdef _LP64
443#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
444#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
445# else
446#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
447#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
448# endif
449#else
450# ifdef __x86_64__
451#  define PTRDIFF_MIN  \
452    _STDINT_MIN (1, 64, 0l)
453#  define PTRDIFF_MAX  \
454    _STDINT_MAX (1, 64, 0l)
455# else
456#  define PTRDIFF_MIN  \
457    _STDINT_MIN (1, 32, 0l)
458#  define PTRDIFF_MAX  \
459    _STDINT_MAX (1, 32, 0l)
460# endif
461#endif
462
463/* sig_atomic_t limits */
464#undef SIG_ATOMIC_MIN
465#undef SIG_ATOMIC_MAX
466#define SIG_ATOMIC_MIN  \
467   _STDINT_MIN (1, 32, \
468                0)
469#define SIG_ATOMIC_MAX  \
470   _STDINT_MAX (1, 32, \
471                0)
472
473
474/* size_t limit */
475#undef SIZE_MAX
476#if 0
477# ifdef _LP64
478#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
479# else
480#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
481# endif
482#else
483# ifdef __x86_64__
484#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
485# else
486#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
487# endif
488#endif
489
490/* wchar_t limits */
491/* Get WCHAR_MIN, WCHAR_MAX.
492   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
493   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
494   <stdint.h> and assumes its types are already defined.  */
495#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
496# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
497# include <wchar.h>
498# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
499#endif
500#undef WCHAR_MIN
501#undef WCHAR_MAX
502#define WCHAR_MIN  \
503   _STDINT_MIN (1, 32, 0)
504#define WCHAR_MAX  \
505   _STDINT_MAX (1, 32, 0)
506
507/* wint_t limits */
508#undef WINT_MIN
509#undef WINT_MAX
510#define WINT_MIN  \
511   _STDINT_MIN (0, 32, 0u)
512#define WINT_MAX  \
513   _STDINT_MAX (0, 32, 0u)
514
515#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
516
517/* 7.18.4. Macros for integer constants */
518
519#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
520
521/* 7.18.4.1. Macros for minimum-width integer constants */
522/* According to ISO C 99 Technical Corrigendum 1 */
523
524/* Here we assume a standard architecture where the hardware integer
525   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
526
527#undef INT8_C
528#undef UINT8_C
529#define INT8_C(x) x
530#define UINT8_C(x) x
531
532#undef INT16_C
533#undef UINT16_C
534#define INT16_C(x) x
535#define UINT16_C(x) x
536
537#undef INT32_C
538#undef UINT32_C
539#define INT32_C(x) x
540#define UINT32_C(x) x ## U
541
542#undef INT64_C
543#undef UINT64_C
544#if LONG_MAX >> 31 >> 31 == 1
545# define INT64_C(x) x##L
546#elif defined _MSC_VER
547# define INT64_C(x) x##i64
548#elif 1
549# define INT64_C(x) x##LL
550#endif
551#if ULONG_MAX >> 31 >> 31 >> 1 == 1
552# define UINT64_C(x) x##UL
553#elif defined _MSC_VER
554# define UINT64_C(x) x##ui64
555#elif 1
556# define UINT64_C(x) x##ULL
557#endif
558
559/* 7.18.4.2. Macros for greatest-width integer constants */
560
561#undef INTMAX_C
562#if 1 && LONG_MAX >> 30 == 1
563# define INTMAX_C(x)   x##LL
564#elif defined GL_INT64_T
565# define INTMAX_C(x)   INT64_C(x)
566#else
567# define INTMAX_C(x)   x##L
568#endif
569
570#undef UINTMAX_C
571#if 1 && ULONG_MAX >> 31 == 1
572# define UINTMAX_C(x)  x##ULL
573#elif defined GL_UINT64_T
574# define UINTMAX_C(x)  UINT64_C(x)
575#else
576# define UINTMAX_C(x)  x##UL
577#endif
578
579#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
580
581#endif /* _GL_STDINT_H */
582#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
583