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