Subversion Repositories shark

Rev

Rev 63 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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