OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [linux/] [sys/] [stdint.h] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
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
/*
10
 * @todo - Add fast<N>_t types.
11
 * @todo - Add support for wint_t types.
12
 */
13
 
14
#ifndef _STDINT_H
15
#define _STDINT_H
16
 
17
#include <sys/types.h>
18
 
19
#ifdef __cplusplus
20
extern "C" {
21
#endif
22
 
23
#if defined(__GNUC__) && (__GNUC__ >= 3 ) \
24
  && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 )
25
#define __STDINT_EXP(x) __##x##__
26
#else
27
#define __STDINT_EXP(x) x
28
#include <limits.h>
29
#endif
30
 
31
#if __STDINT_EXP(SCHAR_MAX) == 0x7f
32
#define __int8_t_defined 1
33
#endif
34
 
35
#if __int8_t_defined
36
typedef signed char int_least8_t;
37
typedef unsigned char uint_least8_t;
38
#define __int_least8_t_defined 1
39
#endif
40
 
41
#if __STDINT_EXP(SHRT_MAX) == 0x7fff
42
#define __int16_t_defined 1
43
#elif __STDINT_EXP(INT_MAX) == 0x7fff
44
#define __int16_t_defined 1
45
#elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
46
#define __int16_t_defined 1
47
#endif
48
 
49
#if __int16_t_defined
50
typedef int16_t         int_least16_t;
51
typedef uint16_t        uint_least16_t;
52
#define __int_least16_t_defined 1
53
 
54
#ifndef __int_least8_t_defined
55
typedef int16_t         int_least8_t;
56
typedef uint16_t        uint_least8_t;
57
#define __int_least8_t_defined 1
58
#endif
59
#endif
60
 
61
#if __STDINT_EXP(INT_MAX) == 0x7fffffffL
62
#define __int32_t_defined 1
63
#elif __STDINT_EXP(LONG_MAX) == 0x7fffffffL
64
#define __int32_t_defined 1
65
#define __have_long32 1
66
#elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
67
#define __int32_t_defined 1
68
#elif __STDINT_EXP(SCHAR_MAX) == 0x7fffffffL
69
#define __int32_t_defined 1
70
#endif
71
 
72
#if __int32_t_defined
73
typedef int32_t         int_least32_t;
74
typedef uint32_t        uint_least32_t;
75
#define __int_least32_t_defined 1
76
 
77
#ifndef __int_least8_t_defined
78
typedef int32_t         int_least8_t;
79
typedef uint32_t        uint_least8_t;
80
#define __int_least8_t_defined 1
81
#endif
82
 
83
#ifndef __int_least16_t_defined
84
typedef int32_t         int_least16_t;
85
typedef uint32_t        uint_least16_t;
86
#define __int_least16_t_defined 1
87
#endif
88
#endif
89
 
90
#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
91
#define __int64_t_defined 1
92
#define __have_long64 1
93
#elif  defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
94
#define __int64_t_defined 1
95
#define __have_longlong64 1
96
#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
97
#define __int64_t_defined 1
98
#define __have_longlong64 1
99
#elif  __STDINT_EXP(INT_MAX) > 0x7fffffff
100
#define __int64_t_defined 1
101
#endif
102
 
103
#if __int64_t_defined
104
typedef int64_t         int_least64_t;
105
typedef uint64_t        uint_least64_t;
106
#define __int_least64_t_defined 1
107
 
108
#ifndef __int_least8_t_defined
109
typedef int64_t         int_least8_t;
110
typedef uint64_t        uint_least8_t;
111
#define __int_least8_t_defined 1
112
#endif
113
 
114
#ifndef __int_least16_t_defined
115
typedef int64_t         int_least16_t;
116
typedef uint64_t        uint_least16_t;
117
#define __int_least16_t_defined 1
118
#endif
119
 
120
#ifndef __int_least32_t_defined
121
typedef int64_t         int_least32_t;
122
typedef uint64_t        uint_least32_t;
123
#define __int_least32_t_defined 1
124
#endif
125
#endif
126
 
127
#if __have_longlong64
128
typedef signed long long intmax_t;
129
typedef unsigned long long uintmax_t;
130
#else
131
typedef signed long intmax_t;
132
typedef unsigned long uintmax_t;
133
#endif
134
 
135
/* Limits of Specified-Width Integer Types */
136
 
137
#if __int8_t_defined
138
#define INT8_MIN        -128
139
#define INT8_MAX         127
140
#define UINT8_MAX        255
141
#endif
142
 
143
#if __int_least8_t_defined
144
#define INT_LEAST8_MIN  -128
145
#define INT_LEAST8_MAX   127
146
#define UINT_LEAST8_MAX  255
147
#else
148
#error required type int_least8_t missing
149
#endif
150
 
151
#if __int16_t_defined
152
#define INT16_MIN       -32768
153
#define INT16_MAX        32767
154
#define UINT16_MAX       65535
155
#endif
156
 
157
#if __int_least16_t_defined
158
#define INT_LEAST16_MIN -32768
159
#define INT_LEAST16_MAX  32767
160
#define UINT_LEAST16_MAX 65535
161
#else
162
#error required type int_least16_t missing
163
#endif
164
 
165
#if __int32_t_defined
166
#define INT32_MIN        (-2147483647-1)
167
#define INT32_MAX        2147483647
168
#define UINT32_MAX       4294967295U
169
#endif
170
 
171
#if __int_least32_t_defined
172
#define INT_LEAST32_MIN  (-2147483647-1)
173
#define INT_LEAST32_MAX  2147483647
174
#define UINT_LEAST32_MAX 4294967295U
175
#else
176
#error required type int_least32_t missing
177
#endif
178
 
179
#if __int64_t_defined
180
#ifdef __have_long64
181
#define INT64_MIN       (-9223372036854775807L-1L)
182
#define INT64_MAX        9223372036854775807L
183
#define UINT64_MAX      18446744073709551615U
184
#elif __have_longlong64
185
#define INT64_MIN       (-9223372036854775807LL-1LL)
186
#define INT64_MAX        9223372036854775807LL
187
#define UINT64_MAX      18446744073709551615ULL
188
#endif
189
#endif
190
 
191
#if __int_least64_t_defined
192
#ifdef __have_long64
193
#define INT_LEAST64_MIN  (-9223372036854775807L-1L)
194
#define INT_LEAST64_MAX  9223372036854775807L
195
#define UINT_LEAST64_MAX 18446744073709551615U
196
#elif __have_longlong64
197
#define INT_LEAST64_MIN  (-9223372036854775807LL-1LL)
198
#define INT_LEAST64_MAX  9223372036854775807LL
199
#define UINT_LEAST64_MAX 18446744073709551615ULL
200
#endif
201
#endif
202
 
203
/* This must match size_t in stddef.h, currently long unsigned int */
204
#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
205
 
206
/* This must match sig_atomic_t in <signal.h> (currently int) */
207
#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
208
#define SIG_ATOMIC_MAX __STDINT_EXP(INT_MAX)
209
 
210
/* This must match ptrdiff_t  in <stddef.h> (currently long int) */
211
#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
212
#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
213
 
214
/** Macros for minimum-width integer constant expressions */
215
#define INT8_C(x)       x
216
#define UINT8_C(x)      x##U
217
 
218
#define INT16_C(x)      x
219
#define UINT16_C(x)     x##U
220
 
221
#if __have_long32
222
#define INT32_C(x)      x##L
223
#define UINT32_C(x)     x##UL
224
#else
225
#define INT32_C(x)      x
226
#define UINT32_C(x)     x##U
227
#endif
228
 
229
#if __int64_t_defined
230
#if __have_longlong64
231
#define INT64_C(x)      x##LL
232
#define UINT64_C(x)     x##ULL
233
#else
234
#define INT64_C(x)      x##L
235
#define UINT64_C(x)     x##UL
236
#endif
237
#endif
238
 
239
/** Macros for greatest-width integer constant expression */
240
#if __have_longlong64
241
#define INTMAX_C(x)     x##LL
242
#define UINTMAX_C(x)    x##ULL
243
#else
244
#define INTMAX_C(x)     x##L
245
#define UINTMAX_C(x)    x##UL
246
#endif
247
 
248
 
249
#ifdef __cplusplus
250
}
251
#endif
252
 
253
#endif /* _STDINT_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.