Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / include / stdint.h
blob9eefd39191b66e17885959311f225a160d9deb48
1 /*-------------------------------------------------------------------------
2 stdint.h - ISO C99 7.18 Integer types <stdint.h>
4 Copyright (C) 2005, Maarten Brock, sourceforge.brock@dse.nl
5 Copyright (C) 2011, Philipp Klaus Krause, pkk@spth.de
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING. If not, write to the
19 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301, USA.
22 As a special exception, if you link this library with other files,
23 some of which are compiled with SDCC, to produce an executable,
24 this library does not by itself cause the resulting executable to
25 be covered by the GNU General Public License. This exception does
26 not however invalidate any other reasons why the executable file
27 might be covered by the GNU General Public License.
28 -------------------------------------------------------------------------*/
30 #ifndef __STDC_VERSION_STDINT_H__
31 #define __STDC_VERSION_STDINT_H__ __STDC_VERSION__
33 /* Exact integral types. */
35 #if !defined(__SDCC_pic14)
36 #if __STDC_VERSION__ >= 199901L
37 #define __SDCC_LONGLONG
38 #endif
39 #endif
41 #ifndef __SPECIFIED_WIDTH_INTEGER_TYPES_DEFINED
42 #define __SPECIFIED_WIDTH_INTEGER_TYPES_DEFINED
44 /* Signed. */
46 typedef signed char int8_t;
47 typedef short int int16_t;
48 typedef long int int32_t;
49 #ifdef __SDCC_LONGLONG
50 typedef long long int int64_t;
51 #endif
53 /* Unsigned. */
54 typedef unsigned char uint8_t;
55 typedef unsigned short int uint16_t;
56 typedef unsigned long int uint32_t;
57 #ifdef __SDCC_LONGLONG
58 typedef unsigned long long int uint64_t;
59 #endif
61 /* Small types. */
63 /* Signed. */
64 typedef signed char int_least8_t;
65 typedef short int int_least16_t;
66 typedef long int int_least32_t;
67 #ifdef __SDCC_LONGLONG
68 typedef long long int int_least64_t;
69 #endif
71 /* Unsigned. */
72 typedef unsigned char uint_least8_t;
73 typedef unsigned short int uint_least16_t;
74 typedef unsigned long int uint_least32_t;
75 #ifdef __SDCC_LONGLONG
76 typedef unsigned long long int uint_least64_t;
77 #endif
79 /* Fast types. */
81 /* Signed. */
82 typedef signed char int_fast8_t;
83 typedef int int_fast16_t;
84 typedef long int int_fast32_t;
85 #ifdef __SDCC_LONGLONG
86 typedef long long int int_fast64_t;
87 #endif
89 /* Unsigned. */
90 typedef unsigned char uint_fast8_t;
91 typedef unsigned int uint_fast16_t;
92 typedef unsigned long int uint_fast32_t;
93 #ifdef __SDCC_LONGLONG
94 typedef unsigned long long int uint_fast64_t;
95 #endif
97 #endif // __SPECIFIED_WIDTH_INTEGER_TYPES_DEFINED
99 /* Types for `void *' pointers. */
100 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
101 typedef long int intptr_t;
102 typedef unsigned long int uintptr_t;
103 #else
104 typedef int intptr_t;
105 typedef unsigned int uintptr_t;
106 #endif
109 /* Largest integral types. */
110 #ifndef __SDCC_LONGLONG
111 typedef long int intmax_t;
112 typedef unsigned long int uintmax_t;
113 #else
114 typedef long long int intmax_t;
115 typedef unsigned long long int uintmax_t;
116 #endif
118 /* Limits of integral types. */
120 /* Minimum of signed integral types. */
121 #define INT8_MIN (-128)
122 #define INT16_MIN (-32767-1)
123 #define INT32_MIN (-2147483647L-1)
124 #ifdef __SDCC_LONGLONG
125 #define INT64_MIN (-9223372036854775807LL-1)
126 #endif
128 /* Maximum of signed integral types. */
129 #define INT8_MAX (127)
130 #define INT16_MAX (32767)
131 #define INT32_MAX (2147483647L)
132 #ifdef __SDCC_LONGLONG
133 #define INT64_MAX (9223372036854775807LL)
134 #endif
136 /* Maximum of unsigned integral types. */
137 #define UINT8_MAX (255)
138 #define UINT16_MAX (65535)
139 #define UINT32_MAX (4294967295UL)
140 #ifdef __SDCC_LONGLONG
141 #define UINT64_MAX (18446744073709551615ULL)
142 #endif
144 /* Minimum of signed integral types having a minimum size. */
145 #define INT_LEAST8_MIN INT8_MIN
146 #define INT_LEAST16_MIN INT16_MIN
147 #define INT_LEAST32_MIN INT32_MIN
148 #ifdef __SDCC_LONGLONG
149 #define INT_LEAST64_MIN INT64_MIN
150 #endif
152 /* Maximum of signed integral types having a minimum size. */
153 #define INT_LEAST8_MAX INT8_MAX
154 #define INT_LEAST16_MAX INT16_MAX
155 #define INT_LEAST32_MAX INT32_MAX
156 #ifdef __SDCC_LONGLONG
157 #define INT_LEAST64_MAX INT64_MAX
158 #endif
160 /* Maximum of unsigned integral types having a minimum size. */
161 #define UINT_LEAST8_MAX UINT8_MAX
162 #define UINT_LEAST16_MAX UINT16_MAX
163 #define UINT_LEAST32_MAX UINT32_MAX
164 #ifdef __SDCC_LONGLONG
165 #define UINT_LEAST64_MAX UINT64_MAX
166 #endif
168 /* Minimum of fast signed integral types having a minimum size. */
169 #define INT_FAST8_MIN INT8_MIN
170 #define INT_FAST16_MIN INT16_MIN
171 #define INT_FAST32_MIN INT32_MIN
172 #ifdef __SDCC_LONGLONG
173 #define INT_FAST64_MIN INT64_MIN
174 #endif
176 /* Maximum of fast signed integral types having a minimum size. */
177 #define INT_FAST8_MAX INT8_MAX
178 #define INT_FAST16_MAX INT16_MAX
179 #define INT_FAST32_MAX INT32_MAX
180 #ifdef __SDCC_LONGLONG
181 #define INT_FAST64_MAX INT64_MAX
182 #endif
184 /* Maximum of fast unsigned integral types having a minimum size. */
185 #define UINT_FAST8_MAX UINT8_MAX
186 #define UINT_FAST16_MAX UINT16_MAX
187 #define UINT_FAST32_MAX UINT32_MAX
188 #ifdef __SDCC_LONGLONG
189 #define UINT_FAST64_MAX UINT64_MAX
190 #endif
192 /* Values to test for integral types holding `void *' pointer. */
193 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
194 #define INTPTR_MIN (-2147483647L-1)
195 #define INTPTR_MAX (2147483647L)
196 #define UINTPTR_MAX (4294967295UL)
197 #else
198 #define INTPTR_MIN (-32767-1)
199 #define INTPTR_MAX (32767)
200 #define UINTPTR_MAX (65535)
201 #endif
203 /* Minimum for largest signed integral type. */
204 #ifndef __SDCC_LONGLONG
205 #define INTMAX_MIN (-2147483647L-1)
206 #else
207 #define INTMAX_MIN (-9223372036854775807LL-1)
208 #endif
210 /* Maximum for largest signed integral type. */
211 #ifndef __SDCC_LONGLONG
212 #define INTMAX_MAX (2147483647L)
213 #else
214 #define INTMAX_MAX (9223372036854775807LL)
215 #endif
217 /* Maximum for largest unsigned integral type. */
218 #ifndef __SDCC_LONGLONG
219 #define UINTMAX_MAX (4294967295UL)
220 #else
221 #define UINTMAX_MAX (18446744073709551615ULL)
222 #endif
224 /* Limits of other integer types. */
226 /* Limits of `ptrdiff_t' type. */
227 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
228 #define PTRDIFF_MIN (-2147483647L-1)
229 #define PTRDIFF_MAX (2147483647L)
230 #else
231 #define PTRDIFF_MIN (-32767-1)
232 #define PTRDIFF_MAX (32767)
233 #endif
235 /* */
236 #define SIG_ATOMIC_MIN (0)
237 #define SIG_ATOMIC_MAX (255)
239 /* Limit of `size_t' type. */
240 #define SIZE_MAX (65535u)
242 /* Signed. */
243 #define INT8_C(c) c
244 #define INT16_C(c) c
245 #define INT32_C(c) c ## L
246 #ifdef __SDCC_LONGLONG
247 #define INT64_C(c) c ## LL
248 #endif
250 /* Unsigned. */
251 #define UINT8_C(c) c ## U
252 #define UINT16_C(c) c ## U
253 #define UINT32_C(c) c ## UL
254 #ifdef __SDCC_LONGLONG
255 #define UINT64_C(c) c ## ULL
256 #endif
258 #define WCHAR_MIN 0
259 #define WCHAR_MAX 0xffffffff
261 #define WINT_MIN 0
262 #define WINT_MAX 0xffffffff
264 /* Maximal type. */
265 #ifdef __SDCC_LONGLONG
266 #define INTMAX_C(c) c ## LL
267 #define UINTMAX_C(c) c ## ULL
268 #else
269 #define INTMAX_C(c) c ## L
270 #define UINTMAX_C(c) c ## UL
271 #endif
273 /* Bounds-checking interfaces from annex K of the C11 standard. */
274 #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
275 #define RSIZE_MAX SIZE_MAX
276 #endif
278 #endif /* stdint.h */