OSDN Git Service

Initial Contribution
[android-x86/prebuilt.git] / darwin-x86 / toolchain / i686-apple-darwin8-4.0.1 / include / gcc / darwin / 4.0 / stdint.h
1 /*
2  * Copyright (c) 2000, 2001, 2003, 2004 Apple Computer, Inc.
3  * All rights reserved.
4  */
5
6 #ifndef _STDINT_H_
7 #define _STDINT_H_
8
9 /* from ISO/IEC 988:1999 spec */
10
11 /* 7.18.1.1 Exact-width integer types */
12 #ifndef _INT8_T
13 #define _INT8_T
14 typedef signed char           int8_t;
15 #endif /*_INT8_T */
16
17 #ifndef _INT16_T
18 #define _INT16_T
19 typedef short                int16_t;
20 #endif /* _INT16_T */
21
22 #ifndef _INT32_T
23 #define _INT32_T
24 typedef int                  int32_t;
25 #endif /* _INT32_T */
26
27 #ifndef _INT64_T
28 #define _INT64_T
29 typedef long long            int64_t;
30 #endif /* _INT64_T */
31
32 #ifndef _UINT8_T
33 #define _UINT8_T
34 typedef unsigned char         uint8_t;
35 #endif /*_UINT8_T */
36
37 #ifndef _UINT16_T
38 #define _UINT16_T
39 typedef unsigned short       uint16_t;
40 #endif /* _UINT16_T */
41
42 #ifndef _UINT32_T
43 #define _UINT32_T
44 typedef unsigned int         uint32_t;
45 #endif /* _UINT32_T */
46
47 #ifndef _UINT64_T
48 #define _UINT64_T
49 typedef unsigned long long   uint64_t;
50 #endif /* _UINT64_T */
51
52 /* 7.18.1.2 Minimum-width integer types */
53 typedef int8_t           int_least8_t;
54 typedef int16_t         int_least16_t;
55 typedef int32_t         int_least32_t;
56 typedef int64_t         int_least64_t;
57 typedef uint8_t         uint_least8_t;
58 typedef uint16_t       uint_least16_t;
59 typedef uint32_t       uint_least32_t;
60 typedef uint64_t       uint_least64_t;
61
62
63 /* 7.18.1.3 Fastest-width integer types */
64 typedef int8_t            int_fast8_t;
65 typedef int16_t          int_fast16_t;
66 typedef int32_t          int_fast32_t;
67 typedef int64_t          int_fast64_t;
68 typedef uint8_t          uint_fast8_t;
69 typedef uint16_t        uint_fast16_t;
70 typedef uint32_t        uint_fast32_t;
71 typedef uint64_t        uint_fast64_t;
72
73
74 /* 7.18.1.4 Integer types capable of holding object pointers */
75
76 #ifndef _INTPTR_T
77 #define _INTPTR_T
78 typedef long   intptr_t;
79 #endif /* _INTPTR_T */
80
81 #ifndef _UINTPTR_T
82 #define _UINTPTR_T
83 typedef unsigned long   uintptr_t;
84 #endif /* _UINTPTR_T */
85
86
87 /* 7.18.1.5 Greatest-width integer types */
88 #ifndef _INTMAX_T
89 #define _INTMAX_T
90 #ifdef __INTMAX_TYPE__
91 typedef __INTMAX_TYPE__             intmax_t;
92 #else /* __INTMAX_TYPE__ */
93 typedef long long                intmax_t;
94 #endif /* __INTMAX_TYPE__ */
95 #endif /* _INTMAX_T */
96
97 #ifndef _UINTMAX_T
98 #define _UINTMAX_T
99 #ifdef __UINTMAX_TYPE__
100 typedef __UINTMAX_TYPE__             uintmax_t;
101 #else /* __UINTMAX_TYPE__ */
102 typedef unsigned long long      uintmax_t;
103 #endif /* __UINTMAX_TYPE__ */
104 #endif /* _UINTMAX_T */
105
106 /* "C++ implementations should define these macros only when
107  *  __STDC_LIMIT_MACROS is defined before <stdint.h> is included."
108  * In other words, if C++, then __STDC_LIMIT_MACROS enables the
109  * macros below.  (Note that there also exists a different enabling
110  * macro (__STDC_CONSTANT_MACROS) for the last few, below.)
111  */
112 #if (! defined(__cplusplus)) || defined(__STDC_LIMIT_MACROS)
113
114
115 /* 7.18.2 Limits of specified-width integer types:
116  *   These #defines specify the minimum and maximum limits
117  *   of each of the types declared above.
118  */
119
120
121 /* 7.18.2.1 Limits of exact-width integer types */
122 #define INT8_MAX         127
123 #define INT16_MAX        32767
124 #define INT32_MAX        2147483647
125 #define INT64_MAX        9223372036854775807LL
126
127 #define INT8_MIN          -128
128 #define INT16_MIN         -32768
129    /*
130       Note:  the literal "most negative int" cannot be written in C --
131       the rules in the standard (section 6.4.4.1 in C99) will give it
132       an unsigned type, so INT32_MIN (and the most negative member of
133       any larger signed type) must be written via a constant expression.
134    */
135 #define INT32_MIN        (-INT32_MAX-1)
136 #define INT64_MIN        (-INT64_MAX-1)
137
138 #define UINT8_MAX         255
139 #define UINT16_MAX        65535
140 #define UINT32_MAX        4294967295U
141 #define UINT64_MAX        18446744073709551615ULL
142
143 /* 7.18.2.2 Limits of minimum-width integer types */
144 #define INT_LEAST8_MIN    INT8_MIN
145 #define INT_LEAST16_MIN   INT16_MIN
146 #define INT_LEAST32_MIN   INT32_MIN
147 #define INT_LEAST64_MIN   INT64_MIN
148
149 #define INT_LEAST8_MAX    INT8_MAX
150 #define INT_LEAST16_MAX   INT16_MAX
151 #define INT_LEAST32_MAX   INT32_MAX
152 #define INT_LEAST64_MAX   INT64_MAX
153
154 #define UINT_LEAST8_MAX   UINT8_MAX
155 #define UINT_LEAST16_MAX  UINT16_MAX
156 #define UINT_LEAST32_MAX  UINT32_MAX
157 #define UINT_LEAST64_MAX  UINT64_MAX
158
159 /* 7.18.2.3 Limits of fastest minimum-width integer types */
160 #define INT_FAST8_MIN     INT8_MIN
161 #define INT_FAST16_MIN    INT16_MIN
162 #define INT_FAST32_MIN    INT32_MIN
163 #define INT_FAST64_MIN    INT64_MIN
164
165 #define INT_FAST8_MAX     INT8_MAX
166 #define INT_FAST16_MAX    INT16_MAX
167 #define INT_FAST32_MAX    INT32_MAX
168 #define INT_FAST64_MAX    INT64_MAX
169
170 #define UINT_FAST8_MAX    UINT8_MAX
171 #define UINT_FAST16_MAX   UINT16_MAX
172 #define UINT_FAST32_MAX   UINT32_MAX
173 #define UINT_FAST64_MAX   UINT64_MAX
174
175 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
176
177 #define INTPTR_MIN        INT32_MIN
178 #define INTPTR_MAX        INT32_MAX
179                              
180 #define UINTPTR_MAX       UINT32_MAX
181
182 /* 7.18.2.5 Limits of greatest-width integer types */
183 #define INTMAX_MIN        INT64_MIN
184 #define INTMAX_MAX        INT64_MAX
185
186 #define UINTMAX_MAX       UINT64_MAX
187
188 /* 7.18.3 "Other" */
189 #define PTRDIFF_MIN       INT32_MIN
190 #define PTRDIFF_MAX       INT32_MAX
191
192 /* We have no sig_atomic_t yet, so no SIG_ATOMIC_{MIN,MAX}.
193    Should end up being {-127,127} or {0,255} ... or bigger.
194    My bet would be on one of {U}INT32_{MIN,MAX}. */
195
196 #define SIZE_MAX          UINT32_MAX
197
198 #ifndef WCHAR_MAX
199 #  ifdef __WCHAR_MAX__
200 #    define WCHAR_MAX     __WCHAR_MAX__
201 #  else
202 #    define WCHAR_MAX     0x7fffffff
203 #  endif
204 #endif
205
206 /* WCHAR_MIN should be 0 if wchar_t is an unsigned type and
207    (-WCHAR_MAX-1) if wchar_t is a signed type.  Unfortunately,
208    it turns out that -fshort-wchar changes the signedness of
209    the type. */
210 #ifndef WCHAR_MIN
211 #  if WCHAR_MAX == 0xffff
212 #    define WCHAR_MIN       0
213 #  else
214 #    define WCHAR_MIN       (-WCHAR_MAX-1)
215 #  endif
216 #endif
217
218 #define WINT_MIN          INT32_MIN
219 #define WINT_MAX          INT32_MAX
220
221 #define SIG_ATOMIC_MIN    INT32_MIN
222 #define SIG_ATOMIC_MAX    INT32_MAX
223
224 #endif /* if C++, then __STDC_LIMIT_MACROS enables the above macros */
225
226 /* "C++ implementations should define these macros only when
227  *  __STDC_CONSTANT_MACROS is defined before <stdint.h> is included."
228  */ 
229 #if (! defined(__cplusplus)) || defined(__STDC_CONSTANT_MACROS)
230
231 /* 7.18.4 Macros for integer constants */
232 #define INT8_C(v)    (v)
233 #define INT16_C(v)   (v)
234 #define INT32_C(v)   (v)
235 #define INT64_C(v)   (v ## LL)
236
237 #define UINT8_C(v)   (v ## U)
238 #define UINT16_C(v)  (v ## U)
239 #define UINT32_C(v)  (v ## U)
240 #define UINT64_C(v)  (v ## ULL)
241
242 #define INTMAX_C(v)  (v ## LL)
243 #define UINTMAX_C(v) (v ## ULL)
244
245 #endif /* if C++, then __STDC_CONSTANT_MACROS enables the above macros */
246
247 #endif /* _STDINT_H_ */