blob: 1470cead5e160c059fc0918e3835873ead94fb76 [file] [log] [blame]
Ben Cheng6e5a1b62014-04-08 14:53:42 -07001/* Copyright (C) 2008-2014 Free Software Foundation, Inc.
2
3This file is part of GCC.
4
5GCC is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 3, or (at your option)
8any later version.
9
10GCC is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15Under Section 7 of GPL version 3, you are granted additional
16permissions described in the GCC Runtime Library Exception, version
173.1, as published by the Free Software Foundation.
18
19You should have received a copy of the GNU General Public License and
20a copy of the GCC Runtime Library Exception along with this program;
21see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22<http://www.gnu.org/licenses/>. */
23
24/*
25 * ISO C Standard: 7.18 Integer types <stdint.h>
26 */
27
28#ifndef _GCC_STDINT_H
29#define _GCC_STDINT_H
30
31/* 7.8.1.1 Exact-width integer types */
32
33#ifdef __INT8_TYPE__
34typedef __INT8_TYPE__ int8_t;
35#endif
36#ifdef __INT16_TYPE__
37typedef __INT16_TYPE__ int16_t;
38#endif
39#ifdef __INT32_TYPE__
40typedef __INT32_TYPE__ int32_t;
41#endif
42#ifdef __INT64_TYPE__
43typedef __INT64_TYPE__ int64_t;
44#endif
45#ifdef __UINT8_TYPE__
46typedef __UINT8_TYPE__ uint8_t;
47#endif
48#ifdef __UINT16_TYPE__
49typedef __UINT16_TYPE__ uint16_t;
50#endif
51#ifdef __UINT32_TYPE__
52typedef __UINT32_TYPE__ uint32_t;
53#endif
54#ifdef __UINT64_TYPE__
55typedef __UINT64_TYPE__ uint64_t;
56#endif
57
58/* 7.8.1.2 Minimum-width integer types */
59
60typedef __INT_LEAST8_TYPE__ int_least8_t;
61typedef __INT_LEAST16_TYPE__ int_least16_t;
62typedef __INT_LEAST32_TYPE__ int_least32_t;
63typedef __INT_LEAST64_TYPE__ int_least64_t;
64typedef __UINT_LEAST8_TYPE__ uint_least8_t;
65typedef __UINT_LEAST16_TYPE__ uint_least16_t;
66typedef __UINT_LEAST32_TYPE__ uint_least32_t;
67typedef __UINT_LEAST64_TYPE__ uint_least64_t;
68
69/* 7.8.1.3 Fastest minimum-width integer types */
70
71typedef __INT_FAST8_TYPE__ int_fast8_t;
72typedef __INT_FAST16_TYPE__ int_fast16_t;
73typedef __INT_FAST32_TYPE__ int_fast32_t;
74typedef __INT_FAST64_TYPE__ int_fast64_t;
75typedef __UINT_FAST8_TYPE__ uint_fast8_t;
76typedef __UINT_FAST16_TYPE__ uint_fast16_t;
77typedef __UINT_FAST32_TYPE__ uint_fast32_t;
78typedef __UINT_FAST64_TYPE__ uint_fast64_t;
79
80/* 7.8.1.4 Integer types capable of holding object pointers */
81
82#ifdef __INTPTR_TYPE__
83typedef __INTPTR_TYPE__ intptr_t;
84#endif
85#ifdef __UINTPTR_TYPE__
86typedef __UINTPTR_TYPE__ uintptr_t;
87#endif
88
89/* 7.8.1.5 Greatest-width integer types */
90
91typedef __INTMAX_TYPE__ intmax_t;
92typedef __UINTMAX_TYPE__ uintmax_t;
93
94#if (!defined __cplusplus || __cplusplus >= 201103L \
95 || defined __STDC_LIMIT_MACROS)
96
97/* 7.18.2 Limits of specified-width integer types */
98
99#ifdef __INT8_MAX__
100# undef INT8_MAX
101# define INT8_MAX __INT8_MAX__
102# undef INT8_MIN
103# define INT8_MIN (-INT8_MAX - 1)
104#endif
105#ifdef __UINT8_MAX__
106# undef UINT8_MAX
107# define UINT8_MAX __UINT8_MAX__
108#endif
109#ifdef __INT16_MAX__
110# undef INT16_MAX
111# define INT16_MAX __INT16_MAX__
112# undef INT16_MIN
113# define INT16_MIN (-INT16_MAX - 1)
114#endif
115#ifdef __UINT16_MAX__
116# undef UINT16_MAX
117# define UINT16_MAX __UINT16_MAX__
118#endif
119#ifdef __INT32_MAX__
120# undef INT32_MAX
121# define INT32_MAX __INT32_MAX__
122# undef INT32_MIN
123# define INT32_MIN (-INT32_MAX - 1)
124#endif
125#ifdef __UINT32_MAX__
126# undef UINT32_MAX
127# define UINT32_MAX __UINT32_MAX__
128#endif
129#ifdef __INT64_MAX__
130# undef INT64_MAX
131# define INT64_MAX __INT64_MAX__
132# undef INT64_MIN
133# define INT64_MIN (-INT64_MAX - 1)
134#endif
135#ifdef __UINT64_MAX__
136# undef UINT64_MAX
137# define UINT64_MAX __UINT64_MAX__
138#endif
139
140#undef INT_LEAST8_MAX
141#define INT_LEAST8_MAX __INT_LEAST8_MAX__
142#undef INT_LEAST8_MIN
143#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
144#undef UINT_LEAST8_MAX
145#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
146#undef INT_LEAST16_MAX
147#define INT_LEAST16_MAX __INT_LEAST16_MAX__
148#undef INT_LEAST16_MIN
149#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
150#undef UINT_LEAST16_MAX
151#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
152#undef INT_LEAST32_MAX
153#define INT_LEAST32_MAX __INT_LEAST32_MAX__
154#undef INT_LEAST32_MIN
155#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
156#undef UINT_LEAST32_MAX
157#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
158#undef INT_LEAST64_MAX
159#define INT_LEAST64_MAX __INT_LEAST64_MAX__
160#undef INT_LEAST64_MIN
161#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
162#undef UINT_LEAST64_MAX
163#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
164
165#undef INT_FAST8_MAX
166#define INT_FAST8_MAX __INT_FAST8_MAX__
167#undef INT_FAST8_MIN
168#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
169#undef UINT_FAST8_MAX
170#define UINT_FAST8_MAX __UINT_FAST8_MAX__
171#undef INT_FAST16_MAX
172#define INT_FAST16_MAX __INT_FAST16_MAX__
173#undef INT_FAST16_MIN
174#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
175#undef UINT_FAST16_MAX
176#define UINT_FAST16_MAX __UINT_FAST16_MAX__
177#undef INT_FAST32_MAX
178#define INT_FAST32_MAX __INT_FAST32_MAX__
179#undef INT_FAST32_MIN
180#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
181#undef UINT_FAST32_MAX
182#define UINT_FAST32_MAX __UINT_FAST32_MAX__
183#undef INT_FAST64_MAX
184#define INT_FAST64_MAX __INT_FAST64_MAX__
185#undef INT_FAST64_MIN
186#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
187#undef UINT_FAST64_MAX
188#define UINT_FAST64_MAX __UINT_FAST64_MAX__
189
190#ifdef __INTPTR_MAX__
191# undef INTPTR_MAX
192# define INTPTR_MAX __INTPTR_MAX__
193# undef INTPTR_MIN
194# define INTPTR_MIN (-INTPTR_MAX - 1)
195#endif
196#ifdef __UINTPTR_MAX__
197# undef UINTPTR_MAX
198# define UINTPTR_MAX __UINTPTR_MAX__
199#endif
200
201#undef INTMAX_MAX
202#define INTMAX_MAX __INTMAX_MAX__
203#undef INTMAX_MIN
204#define INTMAX_MIN (-INTMAX_MAX - 1)
205#undef UINTMAX_MAX
206#define UINTMAX_MAX __UINTMAX_MAX__
207
208/* 7.18.3 Limits of other integer types */
209
210#undef PTRDIFF_MAX
211#define PTRDIFF_MAX __PTRDIFF_MAX__
212#undef PTRDIFF_MIN
213#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
214
215#undef SIG_ATOMIC_MAX
216#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
217#undef SIG_ATOMIC_MIN
218#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
219
220#undef SIZE_MAX
221#define SIZE_MAX __SIZE_MAX__
222
223#undef WCHAR_MAX
224#define WCHAR_MAX __WCHAR_MAX__
225#undef WCHAR_MIN
226#define WCHAR_MIN __WCHAR_MIN__
227
228#undef WINT_MAX
229#define WINT_MAX __WINT_MAX__
230#undef WINT_MIN
231#define WINT_MIN __WINT_MIN__
232
233#endif /* (!defined __cplusplus || __cplusplus >= 201103L
234 || defined __STDC_LIMIT_MACROS) */
235
236#if (!defined __cplusplus || __cplusplus >= 201103L \
237 || defined __STDC_CONSTANT_MACROS)
238
239#undef INT8_C
240#define INT8_C(c) __INT8_C(c)
241#undef INT16_C
242#define INT16_C(c) __INT16_C(c)
243#undef INT32_C
244#define INT32_C(c) __INT32_C(c)
245#undef INT64_C
246#define INT64_C(c) __INT64_C(c)
247#undef UINT8_C
248#define UINT8_C(c) __UINT8_C(c)
249#undef UINT16_C
250#define UINT16_C(c) __UINT16_C(c)
251#undef UINT32_C
252#define UINT32_C(c) __UINT32_C(c)
253#undef UINT64_C
254#define UINT64_C(c) __UINT64_C(c)
255#undef INTMAX_C
256#define INTMAX_C(c) __INTMAX_C(c)
257#undef UINTMAX_C
258#define UINTMAX_C(c) __UINTMAX_C(c)
259
260#endif /* (!defined __cplusplus || __cplusplus >= 201103L
261 || defined __STDC_CONSTANT_MACROS) */
262
263#endif /* _GCC_STDINT_H */