Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_cstdint.h
Go to the documentation of this file.
1// -*- C++ -*-
2
30#ifndef _RWSTD_CSTDINT_H_INCLUDED
31#define _RWSTD_CSTDINT_H_INCLUDED
32
33
34#include <rw/_defs.h>
35
36
38
39#ifndef _RWSTD_BNO_TWOS_COMPLEMENT
40# define _RWSTD_T_MIN(tmax) (-(tmax) - 1)
41#else
42# define _RWSTD_T_MIN(tmax) -(tmax)
43#endif
44
45
46
48#ifdef _RWSTD_INT8_T
49
50// optional exact width types
51typedef _RWSTD_INT8_T int8_t;
52typedef _RWSTD_UINT8_T uint8_t;
53
54# define INT8_MAX 127
55# define UINT8_MAX 255U
56# define INT_LEAST8_MAX INT8_MAX
57# define UINT_LEAST8_MAX UINT8_MAX
58# define INT_FAST8_MAX INT8_MAX
59# define UINT_FAST8_MAX UINT8_MAX
60
61#elif defined (_RWSTD_INT16_T)
62
63# define INT_LEAST8_MAX 32767
64# define UINT_LEAST8_MAX 65535U
65# define INT_FAST8_MAX 32767
66# define UINT_FAST8_MAX 65535U
67
68#elif defined (_RWSTD_INT32_T)
69
70# if 4 == _RWSTD_INT_SIZE
71# define INT_LEAST8_MAX _RWSTD_INT_MAX
72# define UINT_LEAST8_MAX _RWSTD_UINT_MAX
73# define INT_FAST8_MAX _RWSTD_INT_MAX
74# define UINT_FAST8_MAX _RWSTD_UINT_MAX
75# elif 4 == _RWSTD_LONG_SIZE
76# define INT_LEAST8_MAX _RWSTD_LONG_MAX
77# define UINT_LEAST8_MAX _RWSTD_ULONG_MAX
78# define INT_FAST8_MAX _RWSTD_LONG_MAX
79# define UINT_FAST8_MAX _RWSTD_ULONG_MAX
80# endif
81
82#elif defined (_RWSTD_INT64_T)
83
84# if 8 == _RWSTD_LONG_SIZE
85# define INT_LEAST8_MAX _RWSTD_LONG_MAX
86# define UINT_LEAST8_MAX _RWSTD_ULONG_MAX
87# define INT_FAST8_MAX _RWSTD_LONG_MAX
88# define UINT_FAST8_MAX _RWSTD_ULONG_MAX
89# elif 8 == _RWSTD_LLONG_SIZE
90# define INT_LEAST8_MAX _RWSTD_LLONG_MAX
91# define UINT_LEAST8_MAX _RWSTD_ULLONG_MAX
92# define INT_FAST8_MAX _RWSTD_LLONG_MAX
93# define UINT_FAST8_MAX _RWSTD_ULLONG_MAX
94# endif
95
96#else // fallback on int
97
98# define INT_LEAST8_MAX _RWSTD_INT_MAX
99# define UINT_LEAST8_MAX _RWSTD_UINT_MAX
100# define INT_FAST8_MAX _RWSTD_INT_MAX
101# define UINT_FAST8_MAX _RWSTD_UINT_MAX
102
103#endif // _RWSTD_INT{8,16,32,64}_T
104
105
106
108#ifdef _RWSTD_INT16_T
109
110// optional exact width types
111typedef _RWSTD_INT16_T int16_t;
112typedef _RWSTD_UINT16_T uint16_t;
113
114# define INT16_MAX 32767
115# define UINT16_MAX 65535U
116
117# define INT_LEAST16_MAX INT16_MAX
118# define UINT_LEAST16_MAX UINT16_MAX
119# define INT_FAST16_MAX INT16_MAX
120# define UINT_FAST16_MAX UINT16_MAX
121
122#elif defined (_RWSTD_INT32_T)
123
124# if 4 == _RWSTD_INT_SIZE
125# define INT_LEAST16_MAX _RWSTD_INT_MAX
126# define UINT_LEAST16_MAX _RWSTD_UINT_MAX
127# define INT_FAST16_MAX _RWSTD_INT_MAX
128# define UINT_FAST16_MAX _RWSTD_UINT_MAX
129# elif 4 == _RWSTD_LONG_SIZE
130# define INT_LEAST16_MAX _RWSTD_LONG_MAX
131# define UINT_LEAST16_MAX _RWSTD_ULONG_MAX
132# define INT_FAST16_MAX _RWSTD_LONG_MAX
133# define UINT_FAST16_MAX _RWSTD_ULONG_MAX
134# endif
135
136#elif defined (_RWSTD_INT64_T)
137
138# if 8 == _RWSTD_LONG_SIZE
139# define INT_LEAST16_MAX _RWSTD_LONG_MAX
140# define UINT_LEAST16_MAX _RWSTD_ULONG_MAX
141# define INT_FAST16_MAX _RWSTD_LONG_MAX
142# define UINT_FAST16_MAX _RWSTD_ULONG_MAX
143# elif 8 == _RWSTD_LLONG_SIZE
144# define INT_LEAST16_MAX _RWSTD_LLONG_MAX
145# define UINT_LEAST16_MAX _RWSTD_ULLONG_MAX
146# define INT_FAST16_MAX _RWSTD_LLONG_MAX
147# define UINT_FAST16_MAX _RWSTD_ULLONG_MAX
148# endif
149
150#else // fallback on int
151
152# define INT_LEAST16_MAX _RWSTD_INT_MAX
153# define UINT_LEAST16_MAX _RWSTD_UINT_MAX
154# define INT_FAST16_MAX _RWSTD_INT_MAX
155# define UINT_FAST16_MAX _RWSTD_UINT_MAX
156
157#endif // _RWSTD_INT{16,32,64}_T
158
159
160
162#ifdef _RWSTD_INT32_T
163
164// optional exact width types
165typedef _RWSTD_INT32_T int32_t;
166typedef _RWSTD_UINT32_T uint32_t;
167
168# if 4 == _RWSTD_INT_SIZE
169# define INT32_MAX _RWSTD_INT_MAX
170# define UINT32_MAX _RWSTD_UINT_MAX
171# elif 4 == _RWSTD_LONG_SIZE
172# define INT32_MAX _RWSTD_LONG_MAX
173# define UINT32_MAX _RWSTD_LONG_MAX
174# endif
175
176# define INT_LEAST32_MAX INT32_MAX
177# define UINT_LEAST32_MAX UINT32_MAX
178# define INT_FAST32_MAX INT32_MAX
179# define UINT_FAST32_MAX UINT32_MAX
180
181#elif defined (_RWSTD_INT64_T)
182
183# if 8 == _RWSTD_LONG_SIZE
184# define INT_LEAST32_MAX _RWSTD_LONG_MAX
185# define UINT_LEAST32_MAX _RWSTD_ULONG_MAX
186# define INT_FAST32_MAX _RWSTD_LONG_MAX
187# define UINT_FAST32_MAX _RWSTD_ULONG_MAX
188# elif 8 == _RWSTD_LLONG_SIZE
189# define INT_LEAST32_MAX _RWSTD_LLONG_MAX
190# define UINT_LEAST32_MAX _RWSTD_ULLONG_MAX
191# define INT_FAST32_MAX _RWSTD_LLONG_MAX
192# define UINT_FAST32_MAX _RWSTD_ULLONG_MAX
193# endif
194
195#else // fallback on int
196
197# define INT32_MAX _RWSTD_INT_MAX
198# define UINT32_MAX _RWSTD_UINT_MAX
199# define INT_LEAST32_MAX _RWSTD_INT_MAX
200# define UINT_LEAST32_MAX _RWSTD_UINT_MAX
201# define INT_FAST32_MAX _RWSTD_INT_MAX
202# define UINT_FAST32_MAX _RWSTD_UINT_MAX
203
204#endif // _RWSTD_INT{32,64}_T
205
206
207
209#ifdef _RWSTD_INT64_T
210
211// optional exact width types
212typedef _RWSTD_INT64_T int64_t;
213typedef _RWSTD_UINT64_T uint64_t;
214
215// 7.18.2.5 of C99 requires that intmax_t be at least 64-bits wide
216typedef _RWSTD_INT64_T intmax_t;
217typedef _RWSTD_UINT64_T uintmax_t;
218
219# if 8 == _RWSTD_LONG_SIZE
220# define INT64_MAX _RWSTD_LONG_MAX
221# define UINT64_MAX _RWSTD_ULONG_MAX
222# elif 8 == _RWSTD_LLONG_SIZE
223# define INT64_MAX _RWSTD_LLONG_MAX
224# define UINT64_MAX _RWSTD_ULLONG_MAX
225# endif
226
227# define INT_LEAST64_MAX INT64_MAX
228# define UINT_LEAST64_MAX UINT64_MAX
229# define INT_FAST64_MAX INT64_MAX
230# define UINT_FAST64_MAX UINT64_MAX
231
232#elif defined (_RWSTD_LONG_LONG) // fallback on long long
233
234// this possibly violates 7.18.2.5 of C99 which requires that intmax_t
235// be at least 64-bits wide
236typedef _RWSTD_LONG_LONG intmax_t;
237typedef unsigned _RWSTD_LONG_LONG uintmax_t;
238
239#else // fallback on long
240
241// this likely violates 7.18.2.5 of C99 which requires that intmax_t
242// be at least 64-bits wide
243typedef long intmax_t;
244typedef unsigned long uintmax_t;
245
246#endif // _RWSTD_INT{64,32,16}_T
247
248
250#if 8 == _RWSTD_PTR_SIZE
251
252typedef _RWSTD_INT64_T intptr_t;
253typedef _RWSTD_UINT64_T uintptr_t;
254
255# define INTPTR_MAX INT64_MAX
256# define UINTPTR_MAX UINT64_MAX
257
258#elif 4 == _RWSTD_PTR_SIZE
259
260typedef _RWSTD_INT32_T intptr_t;
261typedef _RWSTD_UINT32_T uintptr_t;
262
263# define INTPTR_MAX INT32_MAX
264# define UINTPTR_MAX UINT32_MAX
265
266#elif 2 == _RWSTD_PTR_SIZE
267
268typedef _RWSTD_INT16_T intptr_t;
269typedef _RWSTD_UINT16_T uintptr_t;
270
271# define INTPTR_MAX INT16_MAX
272# define UINTPTR_MAX UINT16_MAX
273
274#else // fallback on long
275
276typedef long intptr_t;
277typedef unsigned long uintptr_t;
278
279# define INTPTR_MAX _RWSTD_LONG_MAX
280# define UINTPTR_MAX _RWSTD_LONG_MAX
281
282#endif // {8,16,32,64} == _RWSTD_PTR_SIZE
283
284
286typedef _RWSTD_INT_LEAST8_T int_least8_t;
287typedef _RWSTD_UINT_LEAST8_T uint_least8_t;
288typedef _RWSTD_INT_LEAST8_T int_fast8_t;
289typedef _RWSTD_UINT_LEAST8_T uint_fast8_t;
290
291typedef _RWSTD_INT_LEAST16_T int_least16_t;
292typedef _RWSTD_UINT_LEAST16_T uint_least16_t;
293typedef _RWSTD_INT_LEAST16_T int_fast16_t;
294typedef _RWSTD_UINT_LEAST16_T uint_fast16_t;
295
296typedef _RWSTD_INT_LEAST32_T int_least32_t;
297typedef _RWSTD_UINT_LEAST32_T uint_least32_t;
298typedef _RWSTD_INT_LEAST32_T int_fast32_t;
299typedef _RWSTD_UINT_LEAST32_T uint_fast32_t;
300
301#ifdef _RWSTD_INT_LEAST64_T
302
303typedef _RWSTD_INT_LEAST64_T int_least64_t;
304typedef _RWSTD_UINT_LEAST64_T uint_least64_t;
305typedef _RWSTD_INT_LEAST64_T int_fast64_t;
306typedef _RWSTD_UINT_LEAST64_T uint_fast64_t;
307
308#endif // _RWSTD_INT_LEAST64_T
309
310#ifdef _RWSTD_INT_LEAST128_T
311
312typedef _RWSTD_INT_LEAST128_T int_least128_t;
313typedef _RWSTD_UINT_LEAST128_T uint_least128_t;
314typedef _RWSTD_INT_LEAST128_T int_fast128_t;
315typedef _RWSTD_UINT_LEAST128_T uint_fast128_t;
316
317#endif // _RWSTD_INT_LEAST128_T
318
319
321#define PTRDIFF_MIN _RWSTD_PTRDIFF_MIN
322#define PTRDIFF_MAX _RWSTD_PTRDIFF_MAX
323
324#define SIZE_MAX _RWSTD_SIZE_MAX
325
326#define WCHAR_MIN _RWSTD_WCHAR_MIN
327#define WCHAR_MAX _RWSTD_WCHAR_MAX
328
329#define WINT_MIN _RWSTD_WINT_MIN
330#define WINT_MAX _RWSTD_WINT_MAX
331
332#define SIG_ATOMIC_MIN _RWSTD_SIG_ATOMIC_MIN
333#define SIG_ATOMIC_MAX _RWSTD_SIG_ATOMIC_MAX
334
335
337#define INT8_MIN _RWSTD_T_MIN (INT8_MAX)
338#define INT16_MIN _RWSTD_T_MIN (INT16_MAX)
339#define INT32_MIN _RWSTD_T_MIN (INT32_MAX)
340#define INT64_MIN _RWSTD_T_MIN (INT64_MAX)
341
342#define INT_LEAST8_MIN _RWSTD_T_MIN (INT_LEAST8_MAX)
343#define INT_LEAST16_MIN _RWSTD_T_MIN (INT_LEAST16_MAX)
344#define INT_LEAST32_MIN _RWSTD_T_MIN (INT_LEAST32_MAX)
345#define INT_LEAST64_MIN _RWSTD_T_MIN (INT_LEAST64_MAX)
346
347#define INT_FAST8_MIN _RWSTD_T_MIN (INT_FAST8_MAX)
348#define INT_FAST16_MIN _RWSTD_T_MIN (INT_FAST16_MAX)
349#define INT_FAST32_MIN _RWSTD_T_MIN (INT_FAST32_MAX)
350#define INT_FAST64_MIN _RWSTD_T_MIN (INT_FAST64_MAX)
351
352} // namespace std
353
354
355#endif // _RWSTD_CSTDINT_H_INCLUDED
#define _RWSTD_LONG_LONG
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
Definition json.h:5363