OSDN Git Service

Cleanup the toploevel makefile handing of shared libs. Add weak_alias
[uclinux-h8/uClibc.git] / include / stdint.h
1 /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 /*
20  *      ISO C 9X: 7.18 Integer types <stdint.h>
21  */
22
23 #ifndef _STDINT_H
24 #define _STDINT_H       1
25
26 #include <features.h>
27 #define __need_wchar_t
28 #include <stddef.h>
29 #include <bits/wordsize.h>
30
31 /* Exact integral types.  */
32
33 /* Signed.  */
34
35 /* There is some amount of overlap with <sys/types.h> as known by inet code */
36 #ifndef __int8_t_defined
37 # define __int8_t_defined
38 typedef signed char             int8_t;
39 typedef short int               int16_t;
40 typedef int                     int32_t;
41 # if __WORDSIZE == 64
42 typedef long int                int64_t;
43 # else
44 __extension__
45 typedef long long int           int64_t;
46 # endif
47 #endif
48
49 /* Unsigned.  */
50 typedef unsigned char           uint8_t;
51 typedef unsigned short int      uint16_t;
52 typedef unsigned int            uint32_t;
53 #if __WORDSIZE == 64
54 typedef unsigned long int       uint64_t;
55 #else
56 __extension__
57 typedef unsigned long long int  uint64_t;
58 #endif
59
60
61 /* Small types.  */
62
63 /* Signed.  */
64 typedef signed char             int_least8_t;
65 typedef short int               int_least16_t;
66 typedef int                     int_least32_t;
67 #if __WORDSIZE == 64
68 typedef long int                int_least64_t;
69 #else
70 __extension__
71 typedef long long int           int_least64_t;
72 #endif
73
74 /* Unsigned.  */
75 typedef unsigned char           uint_least8_t;
76 typedef unsigned short int      uint_least16_t;
77 typedef unsigned int            uint_least32_t;
78 #if __WORDSIZE == 64
79 typedef unsigned long int       uint_least64_t;
80 #else
81 __extension__
82 typedef unsigned long long int  uint_least64_t;
83 #endif
84
85
86 /* Fast types.  */
87
88 /* Signed.  */
89 typedef signed char             int_fast8_t;
90 #if __WORDSIZE == 64
91 typedef long int                int_fast16_t;
92 typedef long int                int_fast32_t;
93 typedef long int                int_fast64_t;
94 #else
95 typedef int                     int_fast16_t;
96 typedef int                     int_fast32_t;
97 __extension__
98 typedef long long int           int_fast64_t;
99 #endif
100
101 /* Unsigned.  */
102 typedef unsigned char           uint_fast8_t;
103 #if __WORDSIZE == 64
104 typedef unsigned long int       uint_fast16_t;
105 typedef unsigned long int       uint_fast32_t;
106 typedef unsigned long int       uint_fast64_t;
107 #else
108 typedef unsigned int            uint_fast16_t;
109 typedef unsigned int            uint_fast32_t;
110 __extension__
111 typedef unsigned long long int  uint_fast64_t;
112 #endif
113
114
115 /* Types for `void *' pointers.  */
116 #if __WORDSIZE == 64
117 # ifndef intptr_t
118 typedef long int                intptr_t;
119 #  define intptr_t intptr_t
120 # endif
121 typedef unsigned long int       uintptr_t;
122 #else
123 # ifndef intptr_t
124 typedef int                     intptr_t;
125 #  define intptr_t intptr_t
126 # endif
127 typedef unsigned int            uintptr_t;
128 #endif
129
130
131 /* Largest integral types.  */
132 #if __WORDSIZE == 64
133 typedef long int                intmax_t;
134 typedef unsigned long int       uintmax_t;
135 #else
136 __extension__
137 typedef long long int           intmax_t;
138 __extension__
139 typedef unsigned long long int  uintmax_t;
140 #endif
141
142
143 /* The ISO C 9X standard specifies that in C++ implementations these
144    macros should only be defined if explicitly requested.  */
145 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
146
147 # if __WORDSIZE == 64
148 #  define __INT64_C(c)  c ## L
149 #  define __UINT64_C(c) c ## UL
150 # else
151 #  define __INT64_C(c)  c ## LL
152 #  define __UINT64_C(c) c ## ULL
153 # endif
154
155 /* Limits of integral types.  */
156
157 /* Minimum of signed integral types.  */
158 # define INT8_MIN               (-128)
159 # define INT16_MIN              (-32767-1)
160 # define INT32_MIN              (-2147483647-1)
161 # define INT64_MIN              (-__INT64_C(9223372036854775807)-1)
162 /* Maximum of signed integral types.  */
163 # define INT8_MAX               (127)
164 # define INT16_MAX              (32767)
165 # define INT32_MAX              (2147483647)
166 # define INT64_MAX              (__INT64_C(9223372036854775807))
167
168 /* Maximum of unsigned integral types.  */
169 # define UINT8_MAX              (255U)
170 # define UINT16_MAX             (65535U)
171 # define UINT32_MAX             (4294967295U)
172 # define UINT64_MAX             (__UINT64_C(18446744073709551615))
173
174
175 /* Minimum of signed integral types having a minimum size.  */
176 # define INT_LEAST8_MIN         (-128)
177 # define INT_LEAST16_MIN        (-32767-1)
178 # define INT_LEAST32_MIN        (-2147483647-1)
179 # define INT_LEAST64_MIN        (-__INT64_C(9223372036854775807)-1)
180 /* Maximum of signed integral types having a minimum size.  */
181 # define INT_LEAST8_MAX         (127)
182 # define INT_LEAST16_MAX        (32767)
183 # define INT_LEAST32_MAX        (2147483647)
184 # define INT_LEAST64_MAX        (__INT64_C(9223372036854775807))
185
186 /* Maximum of unsigned integral types having a minimum size.  */
187 # define UINT_LEAST8_MAX        (255U)
188 # define UINT_LEAST16_MAX       (65535U)
189 # define UINT_LEAST32_MAX       (4294967295U)
190 # define UINT_LEAST64_MAX       (__UINT64_C(18446744073709551615))
191
192
193 /* Minimum of fast signed integral types having a minimum size.  */
194 # define INT_FAST8_MIN          (-128)
195 # if __WORDSIZE == 64
196 #  define INT_FAST16_MIN        (-9223372036854775807L-1)
197 #  define INT_FAST32_MIN        (-9223372036854775807L-1)
198 # else
199 #  define INT_FAST16_MIN        (-2147483647-1)
200 #  define INT_FAST32_MIN        (-2147483647-1)
201 # endif
202 # define INT_FAST64_MIN         (-__INT64_C(9223372036854775807)-1)
203 /* Maximum of fast signed integral types having a minimum size.  */
204 # define INT_FAST8_MAX          (127)
205 # if __WORDSIZE == 64
206 #  define INT_FAST16_MAX        (9223372036854775807L)
207 #  define INT_FAST32_MAX        (9223372036854775807L)
208 # else
209 #  define INT_FAST16_MAX        (2147483647)
210 #  define INT_FAST32_MAX        (2147483647)
211 # endif
212 # define INT_FAST64_MAX         (__INT64_C(9223372036854775807))
213
214 /* Maximum of fast unsigned integral types having a minimum size.  */
215 # define UINT_FAST8_MAX         (255U)
216 # if __WORDSIZE == 64
217 #  define UINT_FAST16_MAX       (18446744073709551615UL)
218 #  define UINT_FAST32_MAX       (18446744073709551615UL)
219 # else
220 #  define UINT_FAST16_MAX       (4294967295U)
221 #  define UINT_FAST32_MAX       (4294967295U)
222 # endif
223 # define UINT_FAST64_MAX        (__UINT64_C(18446744073709551615))
224
225
226 /* Values to test for integral types holding `void *' pointer.  */
227 # if __WORDSIZE == 64
228 #  define INTPTR_MIN            (-9223372036854775807L-1)
229 #  define INTPTR_MAX            (9223372036854775807L)
230 #  define UINTPTR_MAX           (18446744073709551615UL)
231 # else
232 #  define INTPTR_MIN            (-2147483647-1)
233 #  define INTPTR_MAX            (2147483647)
234 #  define UINTPTR_MAX           (4294967295U)
235 # endif
236
237
238 /* Minimum for largest signed integral type.  */
239 # define INTMAX_MIN             (-__INT64_C(9223372036854775807)-1)
240 /* Maximum for largest signed integral type.  */
241 # define INTMAX_MAX             (__INT64_C(9223372036854775807))
242
243 /* Maximum for largest unsigned integral type.  */
244 # define UINTMAX_MAX            (__UINT64_C(18446744073709551615))
245
246
247 /* Limits of other integer types.  */
248
249 /* Limits of `ptrdiff_t' type.  */
250 # if __WORDSIZE == 64
251 #  define PTRDIFF_MIN           (-9223372036854775807L-1)
252 #  define PTRDIFF_MAX           (9223372036854775807L)
253 # else
254 #  define PTRDIFF_MIN           (-2147483647-1)
255 #  define PTRDIFF_MAX           (2147483647)
256 # endif
257
258 /* Limits of `sig_atomic_t'.  */
259 # define SIG_ATOMIC_MIN         (-2147483647-1)
260 # define SIG_ATOMIC_MAX         (2147483647)
261
262 /* Limit of `size_t' type.  */
263 # if __WORDSIZE == 64
264 #  define SIZE_MAX              (18446744073709551615UL)
265 # else
266 #  define SIZE_MAX              (4294967295U)
267 # endif
268
269 /* Limits of `wchar_t'.  */
270 # ifndef WCHAR_MIN
271 /* These constants might also be defined in <wchar.h>.  */
272 #  define WCHAR_MIN             (0)
273 #  define WCHAR_MAX             (2147483647)
274 # endif
275
276 /* Limits of `wint_t'.  */
277 # define WINT_MIN               (0)
278 # define WINT_MAX               (2147483647)
279
280 #endif  /* C++ && limit macros */
281
282
283 /* The ISO C 9X standard specifies that in C++ implementations these
284    should only be defined if explicitly requested.  */
285 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
286
287 /* Signed.  */
288 # define INT8_C(c)      c
289 # define INT16_C(c)     c
290 # define INT32_C(c)     c
291 # if __WORDSIZE == 64
292 #  define INT64_C(c)    c ## L
293 # else
294 #  define INT64_C(c)    c ## LL
295 # endif
296
297 /* Unsigned.  */
298 # define UINT8_C(c)     c ## U
299 # define UINT16_C(c)    c ## U
300 # define UINT32_C(c)    c ## U
301 # if __WORDSIZE == 64
302 #  define UINT64_C(c)   c ## UL
303 # else
304 #  define UINT64_C(c)   c ## ULL
305 # endif
306
307 /* Maximal type.  */
308 # if __WORDSIZE == 64
309 #  define INTMAX_C(c)   c ## L
310 #  define UINTMAX_C(c)  c ## UL
311 # else
312 #  define INTMAX_C(c)   c ## LL
313 #  define UINTMAX_C(c)  c ## ULL
314 # endif
315
316 #endif  /* C++ && constant macros */
317
318 #endif /* stdint.h */