1 /* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC 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)
10 GCC 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 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
25 * ISO C Standard: 7.18 Integer types <stdint.h>
31 /* 7.8.1.1 Exact-width integer types */
34 typedef __INT8_TYPE__
int8_t;
37 typedef __INT16_TYPE__
int16_t;
40 typedef __INT32_TYPE__
int32_t;
43 typedef __INT64_TYPE__
int64_t;
46 typedef __UINT8_TYPE__
uint8_t;
48 #ifdef __UINT16_TYPE__
49 typedef __UINT16_TYPE__
uint16_t;
51 #ifdef __UINT32_TYPE__
52 typedef __UINT32_TYPE__
uint32_t;
54 #ifdef __UINT64_TYPE__
55 typedef __UINT64_TYPE__
uint64_t;
58 /* 7.8.1.2 Minimum-width integer types */
60 typedef __INT_LEAST8_TYPE__
int_least8_t;
61 typedef __INT_LEAST16_TYPE__
int_least16_t;
62 typedef __INT_LEAST32_TYPE__
int_least32_t;
63 typedef __INT_LEAST64_TYPE__
int_least64_t;
64 typedef __UINT_LEAST8_TYPE__
uint_least8_t;
65 typedef __UINT_LEAST16_TYPE__
uint_least16_t;
66 typedef __UINT_LEAST32_TYPE__
uint_least32_t;
67 typedef __UINT_LEAST64_TYPE__
uint_least64_t;
69 /* 7.8.1.3 Fastest minimum-width integer types */
71 typedef __INT_FAST8_TYPE__
int_fast8_t;
72 typedef __INT_FAST16_TYPE__
int_fast16_t;
73 typedef __INT_FAST32_TYPE__
int_fast32_t;
74 typedef __INT_FAST64_TYPE__
int_fast64_t;
75 typedef __UINT_FAST8_TYPE__
uint_fast8_t;
76 typedef __UINT_FAST16_TYPE__
uint_fast16_t;
77 typedef __UINT_FAST32_TYPE__
uint_fast32_t;
78 typedef __UINT_FAST64_TYPE__
uint_fast64_t;
80 /* 7.8.1.4 Integer types capable of holding object pointers */
82 #ifdef __INTPTR_TYPE__
83 typedef __INTPTR_TYPE__
intptr_t;
85 #ifdef __UINTPTR_TYPE__
86 typedef __UINTPTR_TYPE__
uintptr_t;
89 /* 7.8.1.5 Greatest-width integer types */
91 typedef __INTMAX_TYPE__
intmax_t;
92 typedef __UINTMAX_TYPE__
uintmax_t;
94 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
96 /* 7.18.2 Limits of specified-width integer types */
100 # define INT8_MAX __INT8_MAX__
102 # define INT8_MIN (-INT8_MAX - 1)
106 # define UINT8_MAX __UINT8_MAX__
110 # define INT16_MAX __INT16_MAX__
112 # define INT16_MIN (-INT16_MAX - 1)
114 #ifdef __UINT16_MAX__
116 # define UINT16_MAX __UINT16_MAX__
120 # define INT32_MAX __INT32_MAX__
122 # define INT32_MIN (-INT32_MAX - 1)
124 #ifdef __UINT32_MAX__
126 # define UINT32_MAX __UINT32_MAX__
130 # define INT64_MAX __INT64_MAX__
132 # define INT64_MIN (-INT64_MAX - 1)
134 #ifdef __UINT64_MAX__
136 # define UINT64_MAX __UINT64_MAX__
139 #undef INT_LEAST8_MAX
140 #define INT_LEAST8_MAX __INT_LEAST8_MAX__
141 #undef INT_LEAST8_MIN
142 #define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
143 #undef UINT_LEAST8_MAX
144 #define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
145 #undef INT_LEAST16_MAX
146 #define INT_LEAST16_MAX __INT_LEAST16_MAX__
147 #undef INT_LEAST16_MIN
148 #define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
149 #undef UINT_LEAST16_MAX
150 #define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
151 #undef INT_LEAST32_MAX
152 #define INT_LEAST32_MAX __INT_LEAST32_MAX__
153 #undef INT_LEAST32_MIN
154 #define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
155 #undef UINT_LEAST32_MAX
156 #define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
157 #undef INT_LEAST64_MAX
158 #define INT_LEAST64_MAX __INT_LEAST64_MAX__
159 #undef INT_LEAST64_MIN
160 #define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
161 #undef UINT_LEAST64_MAX
162 #define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
165 #define INT_FAST8_MAX __INT_FAST8_MAX__
167 #define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
168 #undef UINT_FAST8_MAX
169 #define UINT_FAST8_MAX __UINT_FAST8_MAX__
170 #undef INT_FAST16_MAX
171 #define INT_FAST16_MAX __INT_FAST16_MAX__
172 #undef INT_FAST16_MIN
173 #define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
174 #undef UINT_FAST16_MAX
175 #define UINT_FAST16_MAX __UINT_FAST16_MAX__
176 #undef INT_FAST32_MAX
177 #define INT_FAST32_MAX __INT_FAST32_MAX__
178 #undef INT_FAST32_MIN
179 #define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
180 #undef UINT_FAST32_MAX
181 #define UINT_FAST32_MAX __UINT_FAST32_MAX__
182 #undef INT_FAST64_MAX
183 #define INT_FAST64_MAX __INT_FAST64_MAX__
184 #undef INT_FAST64_MIN
185 #define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
186 #undef UINT_FAST64_MAX
187 #define UINT_FAST64_MAX __UINT_FAST64_MAX__
189 #ifdef __INTPTR_MAX__
191 # define INTPTR_MAX __INTPTR_MAX__
193 # define INTPTR_MIN (-INTPTR_MAX - 1)
195 #ifdef __UINTPTR_MAX__
197 # define UINTPTR_MAX __UINTPTR_MAX__
201 #define INTMAX_MAX __INTMAX_MAX__
203 #define INTMAX_MIN (-INTMAX_MAX - 1)
205 #define UINTMAX_MAX __UINTMAX_MAX__
207 /* 7.18.3 Limits of other integer types */
210 #define PTRDIFF_MAX __PTRDIFF_MAX__
212 #define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
214 #undef SIG_ATOMIC_MAX
215 #define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
216 #undef SIG_ATOMIC_MIN
217 #define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
220 #define SIZE_MAX __SIZE_MAX__
223 #define WCHAR_MAX __WCHAR_MAX__
225 #define WCHAR_MIN __WCHAR_MIN__
228 #define WINT_MAX __WINT_MAX__
230 #define WINT_MIN __WINT_MIN__
232 #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
234 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
237 #define INT8_C(c) __INT8_C(c)
239 #define INT16_C(c) __INT16_C(c)
241 #define INT32_C(c) __INT32_C(c)
243 #define INT64_C(c) __INT64_C(c)
245 #define UINT8_C(c) __UINT8_C(c)
247 #define UINT16_C(c) __UINT16_C(c)
249 #define UINT32_C(c) __UINT32_C(c)
251 #define UINT64_C(c) __UINT64_C(c)
253 #define INTMAX_C(c) __INTMAX_C(c)
255 #define UINTMAX_C(c) __UINTMAX_C(c)
257 #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
259 #endif /* _GCC_STDINT_H */