1 /* This file is generated via a rule in Makefile.am from the
2 * ../lib/stdint_.h.in file.
4 * *** DO NOT EDIT THIS FILE DIRECTLY ***
6 * Edit ../lib/stdint_.h instead.
8 /* Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
9 Written by Bruno Haible, Sam Steingold, Peter Burwood.
10 This file is part of gnulib.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software Foundation,
24 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
30 * ISO C 99 <stdint.h> for platforms that lack it.
31 * <http://www.opengroup.org/onlinepubs/007904975/basedefs/stdint.h.html>
34 /* Get wchar_t, WCHAR_MIN, WCHAR_MAX. */
36 /* Get CHAR_BIT, LONG_MIN, LONG_MAX, ULONG_MAX. */
39 /* Get those types that are already defined in other system include files. */
40 #if defined(__FreeBSD__)
41 # include <sys/inttypes.h>
43 #if defined(__sun) && HAVE_SYS_INTTYPES_H
44 # include <sys/inttypes.h>
45 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
46 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
47 But note that <sys/int_types.h> contains only the type definitions! */
48 # define _STDINT_H_HAVE_SYSTEM_INTTYPES
50 #if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
51 # include <inttypes.h>
52 /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
53 UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
54 /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
55 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
56 # define _STDINT_H_HAVE_SYSTEM_INTTYPES
58 #if !(defined(UNIX_CYGWIN32) && defined(__BIT_TYPES_DEFINED__))
59 # define _STDINT_H_NEED_SIGNED_INT_TYPES
62 #if !defined(_STDINT_H_HAVE_SYSTEM_INTTYPES)
64 /* 7.18.1.1. Exact-width integer types */
66 #if !defined(__FreeBSD__)
68 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
69 typedef signed char int8_t;
71 typedef unsigned char uint8_t;
73 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
74 typedef short int16_t;
76 typedef unsigned short uint16_t;
78 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
81 typedef unsigned int uint32_t;
84 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
87 typedef unsigned long uint64_t;
88 #define _STDINT_H_HAVE_INT64
90 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
91 typedef long long int64_t;
93 typedef unsigned long long uint64_t;
94 #define _STDINT_H_HAVE_INT64
95 #elif defined(_MSC_VER)
96 typedef __int64 int64_t;
97 typedef unsigned __int64 uint64_t;
98 #define _STDINT_H_HAVE_INT64
101 #endif /* !FreeBSD */
103 /* 7.18.1.2. Minimum-width integer types */
105 typedef int8_t int_least8_t;
106 typedef uint8_t uint_least8_t;
107 typedef int16_t int_least16_t;
108 typedef uint16_t uint_least16_t;
109 typedef int32_t int_least32_t;
110 typedef uint32_t uint_least32_t;
111 #ifdef _STDINT_H_HAVE_INT64
112 typedef int64_t int_least64_t;
113 typedef uint64_t uint_least64_t;
116 /* 7.18.1.3. Fastest minimum-width integer types */
118 typedef int32_t int_fast8_t;
119 typedef uint32_t uint_fast8_t;
120 typedef int32_t int_fast16_t;
121 typedef uint32_t uint_fast16_t;
122 typedef int32_t int_fast32_t;
123 typedef uint32_t uint_fast32_t;
124 #ifdef _STDINT_H_HAVE_INT64
125 typedef int64_t int_fast64_t;
126 typedef uint64_t uint_fast64_t;
129 /* 7.18.1.4. Integer types capable of holding object pointers */
131 #if !defined(__FreeBSD__)
133 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
134 but this doesn't matter here. */
135 typedef long intptr_t;
136 typedef unsigned long uintptr_t;
138 #endif /* !FreeBSD */
140 /* 7.18.1.5. Greatest-width integer types */
142 #ifdef _STDINT_H_HAVE_INT64
143 typedef int64_t intmax_t;
144 typedef uint64_t uintmax_t;
146 typedef int32_t intmax_t;
147 typedef uint32_t uintmax_t;
150 /* 7.18.2. Limits of specified-width integer types */
152 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
154 /* 7.18.2.1. Limits of exact-width integer types */
156 #define INT8_MIN -128
158 #define UINT8_MAX 255U
159 #define INT16_MIN -32768
160 #define INT16_MAX 32767
161 #define UINT16_MAX 65535U
162 #define INT32_MIN (~INT32_MAX)
163 #define INT32_MAX 2147483647
164 #define UINT32_MAX 4294967295U
165 #ifdef _STDINT_H_HAVE_INT64
166 #define INT64_MIN (~INT64_MAX)
168 #define INT64_MAX 9223372036854775807L
169 #define UINT64_MAX 18446744073709551615UL
171 #define INT64_MAX 9223372036854775807LL
172 #define UINT64_MAX 18446744073709551615ULL
173 #elif defined(_MSC_VER)
174 #define INT64_MAX 9223372036854775807i64
175 #define UINT64_MAX 18446744073709551615ui64
179 /* 7.18.2.2. Limits of minimum-width integer types */
181 #define INT_LEAST8_MIN INT8_MIN
182 #define INT_LEAST8_MAX INT8_MAX
183 #define UINT_LEAST8_MAX UINT8_MAX
184 #define INT_LEAST16_MIN INT16_MIN
185 #define INT_LEAST16_MAX INT16_MAX
186 #define UINT_LEAST16_MAX UINT16_MAX
187 #define INT_LEAST32_MIN INT32_MIN
188 #define INT_LEAST32_MAX INT32_MAX
189 #define UINT_LEAST32_MAX UINT32_MAX
190 #ifdef _STDINT_H_HAVE_INT64
191 #define INT_LEAST64_MIN INT64_MIN
192 #define INT_LEAST64_MAX INT64_MAX
193 #define UINT_LEAST64_MAX UINT64_MAX
196 /* 7.18.2.3. Limits of fastest minimum-width integer types */
198 #define INT_FAST8_MIN INT32_MIN
199 #define INT_FAST8_MAX INT32_MAX
200 #define UINT_FAST8_MAX UINT32_MAX
201 #define INT_FAST16_MIN INT32_MIN
202 #define INT_FAST16_MAX INT32_MAX
203 #define UINT_FAST16_MAX UINT32_MAX
204 #define INT_FAST32_MIN INT32_MIN
205 #define INT_FAST32_MAX INT32_MAX
206 #define UINT_FAST32_MAX UINT32_MAX
207 #ifdef _STDINT_H_HAVE_INT64
208 #define INT_FAST64_MIN INT64_MIN
209 #define INT_FAST64_MAX INT64_MAX
210 #define UINT_FAST64_MAX UINT64_MAX
213 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
215 #define INTPTR_MIN LONG_MIN
216 #define INTPTR_MAX LONG_MAX
217 #define UINTPTR_MAX ULONG_MAX
219 /* 7.18.2.5. Limits of greatest-width integer types */
221 #ifdef _STDINT_H_HAVE_INT64
222 #define INTMAX_MIN INT64_MIN
223 #define INTMAX_MAX INT64_MAX
224 #define UINTMAX_MAX UINT64_MAX
226 #define INTMAX_MIN INT32_MIN
227 #define INTMAX_MAX INT32_MAX
228 #define UINTMAX_MAX UINT32_MAX
231 /* 7.18.3. Limits of other integer types */
233 #define PTRDIFF_MIN (~(ptrdiff_t)0 << (sizeof(ptrdiff_t)*CHAR_BIT-1))
234 #define PTRDIFF_MAX (~PTRDIFF_MIN)
236 /* This may be wrong... */
237 #define SIG_ATOMIC_MIN 0
238 #define SIG_ATOMIC_MAX 127
240 #define SIZE_MAX (~(size_t)0)
242 /* wchar_t limits already defined in <stddef.h>. */
243 /* wint_t limits already defined in <wchar.h>. */
247 /* 7.18.4. Macros for integer constants */
249 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
251 /* 7.18.4.1. Macros for minimum-width integer constants */
254 #define UINT8_C(x) x##U
256 #define UINT16_C(x) x##U
258 #define UINT32_C(x) x##U
260 #define INT64_C(x) x##L
261 #define UINT64_C(x) x##UL
263 #define INT64_C(x) x##LL
264 #define UINT64_C(x) x##ULL
265 #elif defined(_MSC_VER)
266 #define INT64_C(x) x##i64
267 #define UINT64_C(x) x##ui64
270 /* 7.18.4.2. Macros for greatest-width integer constants */
273 #define INTMAX_C(x) x##L
274 #define UINTMAX_C(x) x##UL
276 #define INTMAX_C(x) x##LL
277 #define UINTMAX_C(x) x##ULL
278 #elif defined(_MSC_VER)
279 #define INTMAX_C(x) x##i64
280 #define UINTMAX_C(x) x##ui64
282 #define INTMAX_C(x) x
283 #define UINTMAX_C(x) x##U
288 #endif /* !_STDINT_H_HAVE_SYSTEM_INTTYPES */
290 #endif /* _STDINT_H */