• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/arm-none-eabi/include/
1/*
2 * Copyright (c) 2004, 2005 by
3 * Ralf Corsepius, Ulm/Germany. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software
6 * is freely granted, provided that this notice is preserved.
7 */
8
9#ifndef _STDINT_H
10#define _STDINT_H
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#if defined(__GNUC__) && \
17  ( (__GNUC__ >= 4) || \
18    ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2) ) )
19/* gcc > 3.2 implicitly defines the values we are interested */
20#define __STDINT_EXP(x) __##x##__
21#else
22#define __STDINT_EXP(x) x
23#include <limits.h>
24#endif
25
26/* Check if "long long" is 64bit wide */
27/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
28#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
29  || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
30#define __have_longlong64 1
31#endif
32
33/* Check if "long" is 64bit or 32bit wide */
34#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
35#define __have_long64 1
36#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
37#define __have_long32 1
38#endif
39
40#if __STDINT_EXP(SCHAR_MAX) == 0x7f
41typedef signed char int8_t ;
42typedef unsigned char uint8_t ;
43#define __int8_t_defined 1
44#endif
45
46#if __int8_t_defined
47typedef signed char int_least8_t;
48typedef unsigned char uint_least8_t;
49#define __int_least8_t_defined 1
50#endif
51
52#if __STDINT_EXP(SHRT_MAX) == 0x7fff
53typedef signed short int16_t;
54typedef unsigned short uint16_t;
55#define __int16_t_defined 1
56#elif __STDINT_EXP(INT_MAX) == 0x7fff
57typedef signed int int16_t;
58typedef unsigned int uint16_t;
59#define __int16_t_defined 1
60#elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
61typedef signed char int16_t;
62typedef unsigned char uint16_t;
63#define __int16_t_defined 1
64#endif
65
66#if __int16_t_defined
67typedef int16_t   	int_least16_t;
68typedef uint16_t 	uint_least16_t;
69#define __int_least16_t_defined 1
70
71#if !__int_least8_t_defined
72typedef int16_t	   	int_least8_t;
73typedef uint16_t  	uint_least8_t;
74#define __int_least8_t_defined 1
75#endif
76#endif
77
78#if __have_long32
79typedef signed long int32_t;
80typedef unsigned long uint32_t;
81#define __int32_t_defined 1
82#elif __STDINT_EXP(INT_MAX) == 0x7fffffffL
83typedef signed int int32_t;
84typedef unsigned int uint32_t;
85#define __int32_t_defined 1
86#elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
87typedef signed short int32_t;
88typedef unsigned short uint32_t;
89#define __int32_t_defined 1
90#elif __STDINT_EXP(SCHAR_MAX) == 0x7fffffffL
91typedef signed char int32_t;
92typedef unsigned char uint32_t;
93#define __int32_t_defined 1
94#endif
95
96#if __int32_t_defined
97typedef int32_t   	int_least32_t;
98typedef uint32_t 	uint_least32_t;
99#define __int_least32_t_defined 1
100
101#if !__int_least8_t_defined
102typedef int32_t	   	int_least8_t;
103typedef uint32_t  	uint_least8_t;
104#define __int_least8_t_defined 1
105#endif
106
107#if !__int_least16_t_defined
108typedef int32_t	   	int_least16_t;
109typedef uint32_t  	uint_least16_t;
110#define __int_least16_t_defined 1
111#endif
112#endif
113
114#if __have_long64
115typedef signed long int64_t;
116typedef unsigned long uint64_t;
117#define __int64_t_defined 1
118#elif __have_longlong64
119typedef signed long long int64_t;
120typedef unsigned long long uint64_t;
121#define __int64_t_defined 1
122#elif  __STDINT_EXP(INT_MAX) > 0x7fffffff
123typedef signed int int64_t;
124typedef unsigned int uint64_t;
125#define __int64_t_defined 1
126#endif
127
128#if __int64_t_defined
129typedef int64_t   	int_least64_t;
130typedef uint64_t 	uint_least64_t;
131#define __int_least64_t_defined 1
132
133#if !__int_least8_t_defined
134typedef int64_t	   	int_least8_t;
135typedef uint64_t  	uint_least8_t;
136#define __int_least8_t_defined 1
137#endif
138
139#if !__int_least16_t_defined
140typedef int64_t	   	int_least16_t;
141typedef uint64_t  	uint_least16_t;
142#define __int_least16_t_defined 1
143#endif
144
145#if !__int_least32_t_defined
146typedef int64_t	   	int_least32_t;
147typedef uint64_t  	uint_least32_t;
148#define __int_least32_t_defined 1
149#endif
150#endif
151
152/*
153 * Fastest minimum-width integer types
154 *
155 * Assume int to be the fastest type for all types with a width
156 * less than __INT_MAX__ rsp. INT_MAX
157 */
158#if __STDINT_EXP(INT_MAX) >= 0x7f
159  typedef signed int int_fast8_t;
160  typedef unsigned int uint_fast8_t;
161#define __int_fast8_t_defined 1
162#endif
163
164#if __STDINT_EXP(INT_MAX) >= 0x7fff
165  typedef signed int int_fast16_t;
166  typedef unsigned int uint_fast16_t;
167#define __int_fast16_t_defined 1
168#endif
169
170#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
171  typedef signed int int_fast32_t;
172  typedef unsigned int uint_fast32_t;
173#define __int_fast32_t_defined 1
174#endif
175
176#if __STDINT_EXP(INT_MAX) > 0x7fffffff
177  typedef signed int int_fast64_t;
178  typedef unsigned int uint_fast64_t;
179#define __int_fast64_t_defined 1
180#endif
181
182/*
183 * Fall back to [u]int_least<N>_t for [u]int_fast<N>_t types
184 * not having been defined, yet.
185 * Leave undefined, if [u]int_least<N>_t should not be available.
186 */
187#if !__int_fast8_t_defined
188#if __int_least8_t_defined
189  typedef int_least8_t int_fast8_t;
190  typedef uint_least8_t uint_fast8_t;
191#define __int_fast8_t_defined 1
192#endif
193#endif
194
195#if !__int_fast16_t_defined
196#if __int_least16_t_defined
197  typedef int_least16_t int_fast16_t;
198  typedef uint_least16_t uint_fast16_t;
199#define __int_fast16_t_defined 1
200#endif
201#endif
202
203#if !__int_fast32_t_defined
204#if __int_least32_t_defined
205  typedef int_least32_t int_fast32_t;
206  typedef uint_least32_t uint_fast32_t;
207#define __int_fast32_t_defined 1
208#endif
209#endif
210
211#if !__int_fast64_t_defined
212#if __int_least64_t_defined
213  typedef int_least64_t int_fast64_t;
214  typedef uint_least64_t uint_fast64_t;
215#define __int_fast64_t_defined 1
216#endif
217#endif
218
219/* Greatest-width integer types */
220/* Modern GCCs provide __INTMAX_TYPE__ */
221#if defined(__INTMAX_TYPE__)
222  typedef __INTMAX_TYPE__ intmax_t;
223#elif __have_longlong64
224  typedef signed long long intmax_t;
225#else
226  typedef signed long intmax_t;
227#endif
228
229/* Modern GCCs provide __UINTMAX_TYPE__ */
230#if defined(__UINTMAX_TYPE__)
231  typedef __UINTMAX_TYPE__ uintmax_t;
232#elif __have_longlong64
233  typedef unsigned long long uintmax_t;
234#else
235  typedef unsigned long uintmax_t;
236#endif
237
238/*
239 * GCC doesn't provide an appropriate macro for [u]intptr_t
240 * For now, use __PTRDIFF_TYPE__
241 */
242#if defined(__PTRDIFF_TYPE__)
243typedef signed __PTRDIFF_TYPE__ intptr_t;
244typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
245#define INTPTR_MAX PTRDIFF_MAX
246#define INTPTR_MIN PTRDIFF_MIN
247#ifdef __UINTPTR_MAX__
248#define UINTPTR_MAX __UINTPTR_MAX__
249#else
250#define UINTPTR_MAX (2UL * PTRDIFF_MAX + 1)
251#endif
252#else
253/*
254 * Fallback to hardcoded values,
255 * should be valid on cpu's with 32bit int/32bit void*
256 */
257typedef signed long intptr_t;
258typedef unsigned long uintptr_t;
259#define INTPTR_MAX __STDINT_EXP(LONG_MAX)
260#define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
261#define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
262#endif
263
264/* Limits of Specified-Width Integer Types */
265
266#if __int8_t_defined
267#define INT8_MIN 	-128
268#define INT8_MAX 	 127
269#define UINT8_MAX 	 255
270#endif
271
272#if __int_least8_t_defined
273#define INT_LEAST8_MIN 	-128
274#define INT_LEAST8_MAX 	 127
275#define UINT_LEAST8_MAX	 255
276#else
277#error required type int_least8_t missing
278#endif
279
280#if __int16_t_defined
281#define INT16_MIN 	-32768
282#define INT16_MAX 	 32767
283#define UINT16_MAX 	 65535
284#endif
285
286#if __int_least16_t_defined
287#define INT_LEAST16_MIN	-32768
288#define INT_LEAST16_MAX	 32767
289#define UINT_LEAST16_MAX 65535
290#else
291#error required type int_least16_t missing
292#endif
293
294#if __int32_t_defined
295#if __have_long32
296#define INT32_MIN 	 (-2147483647L-1)
297#define INT32_MAX 	 2147483647L
298#define UINT32_MAX       4294967295UL
299#else
300#define INT32_MIN 	 (-2147483647-1)
301#define INT32_MAX 	 2147483647
302#define UINT32_MAX       4294967295U
303#endif
304#endif
305
306#if __int_least32_t_defined
307#if __have_long32
308#define INT_LEAST32_MIN  (-2147483647L-1)
309#define INT_LEAST32_MAX  2147483647L
310#define UINT_LEAST32_MAX 4294967295UL
311#else
312#define INT_LEAST32_MIN  (-2147483647-1)
313#define INT_LEAST32_MAX  2147483647
314#define UINT_LEAST32_MAX 4294967295U
315#endif
316#else
317#error required type int_least32_t missing
318#endif
319
320#if __int64_t_defined
321#if __have_long64
322#define INT64_MIN 	(-9223372036854775807L-1L)
323#define INT64_MAX 	 9223372036854775807L
324#define UINT64_MAX 	18446744073709551615U
325#elif __have_longlong64
326#define INT64_MIN 	(-9223372036854775807LL-1LL)
327#define INT64_MAX 	 9223372036854775807LL
328#define UINT64_MAX 	18446744073709551615ULL
329#endif
330#endif
331
332#if __int_least64_t_defined
333#if __have_long64
334#define INT_LEAST64_MIN  (-9223372036854775807L-1L)
335#define INT_LEAST64_MAX  9223372036854775807L
336#define UINT_LEAST64_MAX 18446744073709551615U
337#elif __have_longlong64
338#define INT_LEAST64_MIN  (-9223372036854775807LL-1LL)
339#define INT_LEAST64_MAX  9223372036854775807LL
340#define UINT_LEAST64_MAX 18446744073709551615ULL
341#endif
342#endif
343
344#if __int_fast8_t_defined
345#if __STDINT_EXP(INT_MAX) >= 0x7f
346#define INT_FAST8_MIN	(-__STDINT_EXP(INT_MAX)-1)
347#define INT_FAST8_MAX	__STDINT_EXP(INT_MAX)
348#define UINT_FAST8_MAX	(__STDINT_EXP(INT_MAX)*2U+1U)
349#else
350#define INT_FAST8_MIN	INT_LEAST8_MIN
351#define INT_FAST8_MAX	INT_LEAST8_MAX
352#define UINT_FAST8_MAX	UINT_LEAST8_MAX
353#endif
354#endif
355
356#if __int_fast16_t_defined
357#if __STDINT_EXP(INT_MAX) >= 0x7fff
358#define INT_FAST16_MIN	(-__STDINT_EXP(INT_MAX)-1)
359#define INT_FAST16_MAX	__STDINT_EXP(INT_MAX)
360#define UINT_FAST16_MAX	(__STDINT_EXP(INT_MAX)*2U+1U)
361#else
362#define INT_FAST16_MIN	INT_LEAST16_MIN
363#define INT_FAST16_MAX	INT_LEAST16_MAX
364#define UINT_FAST16_MAX	UINT_LEAST16_MAX
365#endif
366#endif
367
368#if __int_fast32_t_defined
369#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
370#define INT_FAST32_MIN	(-__STDINT_EXP(INT_MAX)-1)
371#define INT_FAST32_MAX	__STDINT_EXP(INT_MAX)
372#define UINT_FAST32_MAX	(__STDINT_EXP(INT_MAX)*2U+1U)
373#else
374#define INT_FAST32_MIN	INT_LEAST32_MIN
375#define INT_FAST32_MAX	INT_LEAST32_MAX
376#define UINT_FAST32_MAX	UINT_LEAST32_MAX
377#endif
378#endif
379
380#if __int_fast64_t_defined
381#if __STDINT_EXP(INT_MAX) > 0x7fffffff
382#define INT_FAST64_MIN	(-__STDINT_EXP(INT_MAX)-1)
383#define INT_FAST64_MAX	__STDINT_EXP(INT_MAX)
384#define UINT_FAST64_MAX	(__STDINT_EXP(INT_MAX)*2U+1U)
385#else
386#define INT_FAST64_MIN	INT_LEAST64_MIN
387#define INT_FAST64_MAX	INT_LEAST64_MAX
388#define UINT_FAST64_MAX	UINT_LEAST64_MAX
389#endif
390#endif
391
392#ifdef __INTMAX_MAX__
393#define INTMAX_MAX __INTMAX_MAX__
394#define INTMAX_MIN (-INTMAX_MAX - 1)
395#elif defined(__INTMAX_TYPE__)
396/* All relevant GCC versions prefer long to long long for intmax_t.  */
397#define INTMAX_MAX INT64_MAX
398#define INTMAX_MIN INT64_MIN
399#endif
400
401#ifdef __UINTMAX_MAX__
402#define UINTMAX_MAX __UINTMAX_MAX__
403#elif defined(__UINTMAX_TYPE__)
404/* All relevant GCC versions prefer long to long long for intmax_t.  */
405#define UINTMAX_MAX UINT64_MAX
406#endif
407
408/* This must match size_t in stddef.h, currently long unsigned int */
409#ifdef __SIZE_MAX__
410#define SIZE_MAX __SIZE_MAX__
411#else
412#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
413#endif
414
415/* This must match sig_atomic_t in <signal.h> (currently int) */
416#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
417#define SIG_ATOMIC_MAX __STDINT_EXP(INT_MAX)
418
419/* This must match ptrdiff_t  in <stddef.h> (currently long int) */
420#ifdef __PTRDIFF_MAX__
421#define PTRDIFF_MAX __PTRDIFF_MAX__
422#else
423#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
424#endif
425#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
426
427#ifdef __WCHAR_MAX__
428#define WCHAR_MAX __WCHAR_MAX__
429#endif
430#ifdef __WCHAR_MIN__
431#define WCHAR_MIN __WCHAR_MIN__
432#endif
433
434/* wint_t is unsigned int on almost all GCC targets.  */
435#ifdef __WINT_MAX__
436#define WINT_MAX __WINT_MAX__
437#else
438#define WINT_MAX (__STDINT_EXP(INT_MAX) * 2U + 1U)
439#endif
440#ifdef __WINT_MIN__
441#define WINT_MIN __WINT_MIN__
442#else
443#define WINT_MIN 0U
444#endif
445
446/** Macros for minimum-width integer constant expressions */
447#define INT8_C(x)	x
448#if __STDINT_EXP(INT_MAX) > 0x7f
449#define UINT8_C(x)	x
450#else
451#define UINT8_C(x)	x##U
452#endif
453
454#define INT16_C(x)	x
455#if __STDINT_EXP(INT_MAX) > 0x7fff
456#define UINT16_C(x)	x
457#else
458#define UINT16_C(x)	x##U
459#endif
460
461#if __have_long32
462#define INT32_C(x)	x##L
463#define UINT32_C(x)	x##UL
464#else
465#define INT32_C(x)	x
466#define UINT32_C(x)	x##U
467#endif
468
469#if __int64_t_defined
470#if __have_long64
471#define INT64_C(x)	x##L
472#define UINT64_C(x)	x##UL
473#else
474#define INT64_C(x)	x##LL
475#define UINT64_C(x)	x##ULL
476#endif
477#endif
478
479/** Macros for greatest-width integer constant expression */
480#if __have_long64
481#define INTMAX_C(x)	x##L
482#define UINTMAX_C(x)	x##UL
483#else
484#define INTMAX_C(x)	x##LL
485#define UINTMAX_C(x)	x##ULL
486#endif
487
488
489#ifdef __cplusplus
490}
491#endif
492
493#endif /* _STDINT_H */
494