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