ae2f_docs
Loading...
Searching...
No Matches
StdInt.h
Go to the documentation of this file.
1/**
2 * @file StdInt.h
3 * @brief stdint subset for c90
4 * @warning
5 * - Following types are guaranteed `at least of` that size, NOT `exact` as that size. \n
6 * - This is for convention. Do not believe its types are guaranteed as fixed. \n
7 * - This file may not contain 64 bits.
8 *
9 * */
10#ifndef ae2f_stdint_h
11#define ae2f_stdint_h
12
13#include "./have-stdint.auto.h"
14
16#include <stdint.h>
17
18#elif defined(__cplusplus) && __cplusplus >= 201103L
19#include <cstdint>
20
21#else
22#include "./ptrsz.auto.h"
23#include "./Limits.h"
24
25#ifndef int_fast8_t
26typedef signed int int_fast8_t;
27#define int_fast8_t int_fast8_t
28#endif
29typedef char ae2f_CHECK[sizeof(int_fast8_t) >= 1 ? 1 : - 1];
30
31#ifndef int_least8_t
32typedef signed char int_least8_t;
33#define int_least8_t int_least8_t
34#endif
35typedef char ae2f_CHECK[sizeof(int_least8_t) >= 1 ? 1 : - 1];
36
37#if !defined(i8) && SCHAR_WIDTH == 8
38#define int8_t int_least8_t
39typedef char ae2f_CHECK[sizeof(int8_t) == 1 ? 1 : - 1];
40#endif
41
42#ifndef uint_fast8_t
43#define uint_fast8_t unsigned int
44#endif
45typedef char ae2f_CHECK[sizeof(uint_fast8_t) >= 1 ? 1 : - 1];
46
47#ifndef uint_least8_t
48#define uint_least8_t unsigned char
49#endif
50typedef char ae2f_CHECK[sizeof(uint_least8_t) >= 1 ? 1 : - 1];
51
52#if !defined(uint8_t) && UCHAR_WIDTH == 8
53#define uint8_t uint_least8_t
54typedef char ae2f_CHECK[sizeof(uint8_t) == 1 ? 1 : - 1];
55#endif
56
57/* CHAR */
58
59#ifndef int_fast16_t
60#define int_fast16_t signed int
61#endif
62typedef char ae2f_CHECK[sizeof(int_fast16_t) >= 2 ? 1 : - 1];
63
64#ifndef int_least16_t
65#define int_least16_t signed short
66#endif
67typedef char ae2f_CHECK[sizeof(int_least16_t) >= 2 ? 1 : - 1];
68
69#if !defined(int16_t) && SHRT_WIDTH == 16
70#define int16_t int_least16_t
71#endif
72typedef char ae2f_CHECK[sizeof(int16_t) == 2 ? 1 : - 1];
73
74#ifndef uint_fast16_t
75#define uint_fast16_t unsigned int
76#endif
77typedef char ae2f_CHECK[sizeof(uint_fast16_t) >= 2 ? 1 : - 1];
78
79#ifndef uint_least16_t
80#define uint_least16_t unsigned short
81#endif
82typedef char ae2f_CHECK[sizeof(uint_least16_t) >= 2 ? 1 : - 1];
83
84#if !defined(uint16_t) && USHRT_WIDTH == 16
85#define uint16_t uint_least16_t
86typedef char ae2f_CHECK[sizeof(uint16_t) == 2 ? 1 : - 1];
87#endif
88/* SHRT */
89
90#if !defined(int_least32_t) && INT_WIDTH >= 32
91#define int_least32_t signed int
92#elif !defined(int_least32_t)
93#define int_least32_t signed long
94#endif
95typedef char ae2f_CHECK[sizeof(int_least32_t) >= 4 ? 1 : -1];
96
97#ifndef int_fast32_t
98#define int_fast32_t int_least32_t
99#endif
100typedef char ae2f_CHECK[sizeof(int_fast32_t) >= 4 ? 1 : -1];
101
102#if !defined(int32_t) && INT_WIDTH == 32
103#define int32_t int_least32_t
104typedef char ae2f_CHECK[sizeof(int32_t) == 4 ? 1 : -1];
105#endif
106
107#if !defined(uint_least32_t) && UINT_WIDTH >= 32
108#define uint_least32_t unsigned int
109#elif !defined(uint_least32_t)
110#define uint_least32_t unsigned long
111#endif
112typedef char ae2f_CHECK[sizeof(uint_least32_t) >= 4 ? 1 : -1];
113
114#ifndef uint_fast32_t
115#define uint_fast32_t uint_least32_t
116#endif
117typedef char ae2f_CHECK[sizeof(uint_fast32_t) >= 4 ? 1 : -1];
118
119#if !defined(uint32_t) && UINT_WIDTH == 32
120#define uint32_t uint_least32_t
121typedef char ae2f_CHECK[sizeof(uint32_t) == 4 ? 1 : -1];
122#endif
123
124/** INT32 */
125
126
127#if !defined(int_least64_t) && LONG_WIDTH >= 64
128#define int_least64_t signed long
129#define INT_LEAST64_WIDTH LONG_WIDTH
130#elif LLONG_WIDTH >= 64
131#define int_least64_t signed long long
132#define INT_LEAST64_WIDTH LLONG_WIDTH
133#endif
134#ifdef int_least64_t
135typedef char ae2f_CHECK[sizeof(int_least64_t) >= 8 ? 1 : -1];
136#endif
137
138#if defined(int_least64_t) && !defined(int_fast64_t)
139#define int_fast64_t int_least64_t
140typedef char ae2f_CHECK[sizeof(int_fast64_t) >= 8 ? 1 : -1];
141#endif
142
143#if defined(int_least64_t) && !defined(int64_t) && INT_LEAST64_WIDTH == 64
144#define int64_t int_least64_t
145typedef char ae2f_CHECK[sizeof(int64_t) == 8 ? 1 : -1];
146#endif
147
148#if !defined(uint_least64_t) && ULONG_WIDTH >= 64
149#define uint_least64_t unsigned long
150#define UINT_LEAST64_WIDTH ULONG_WIDTH
151#elif ULLONG_WIDTH >= 64
152#define uint_least64_t unsigned long long
153#define UINT_LEAST64_WIDTH ULLONG_WIDTH
154#endif
155#ifdef uint_least64_t
156typedef char ae2f_CHECK[sizeof(uint_least64_t) >= 8 ? 1 : -1];
157#endif
158
159#if defined(uint_least64_t) && !defined(uint_fast64_t)
160#define uint_fast64_t uint_least64_t
161typedef char ae2f_CHECK[sizeof(uint_fast64_t) >= 8 ? 1 : -1];
162#endif
163
164#if defined(uint_least64_t) && !defined(uint64_t) && UINT_LEAST64_WIDTH == 64
165#define uint64_t uint_least64_t
166typedef char ae2f_CHECK[sizeof(uint64_t) == 8 ? 1 : -1];
167#endif
168/* INT64 */
169
170#if ae2f_PTRSZ_SIZE == 1
171
172#ifndef intptr_t
173#define intptr_t int_least8_t
174#endif
175
176#ifndef uintptr_t
177#define uintptr_t uint_least8_t
178#endif
179
180#elif ae2f_PTRSZ_SIZE <= 2
181
182#ifndef intptr_t
183#define intptr_t int_least16_t
184#endif
185
186#ifndef uintptr_t
187#define uintptr_t uint_least16_t
188#endif
189
190#elif ae2f_PTRSZ_SIZE <= 4
191
192#ifndef intptr_t
193#define intptr_t int_least32_t
194#endif
195
196#ifndef uintptr_t
197#define uintptr_t uint_least32_t
198#endif
199
200#elif ae2f_PTRSZ_SIZE <= 8
201
202#if !defined(intptr_t) && defined(int_least64_t)
203#define intptr_t int_least64_t
204#endif
205
206#if !defined(uintptr_t) && defined(uint_least64_t)
207#define uintptr_t uint_least64_t
208#endif
209
210#endif
211
212typedef char ae2f_CHECK[sizeof(int_least32_t) >= 4 ? 1 : -1];
213typedef char ae2f_CHECK[sizeof(uint_least32_t) >= 4 ? 1 : -1];
214
215typedef char ae2f_CHECK[sizeof(int_least64_t) >= 8 ? 1 : -1];
216typedef char ae2f_CHECK[sizeof(uint_least64_t) >= 8 ? 1 : -1];
217
218typedef char ae2f_CHECK[sizeof(intptr_t) >= sizeof(void*) ? 1 : -1];
219typedef char ae2f_CHECK[sizeof(uintptr_t) >= sizeof(void*) ? 1 : -1];
220
221#endif
222
223#ifndef i8_fast
224#define i8_fast int_fast8_t
225#endif
226
227#ifndef i16_fast
228#define i16_fast int_fast16_t
229#endif
230
231#ifndef i32_fast
232#define i32_fast int_fast32_t
233#endif
234
235#ifndef i64_fast
236#define i64_fast int_fast64_t
237#endif
238
239#ifndef u8_fast
240#define u8_fast uint_fast8_t
241#endif
242
243#ifndef u16_fast
244#define u16_fast uint_fast16_t
245#endif
246
247#ifndef u32_fast
248#define u32_fast uint_fast32_t
249#endif
250
251#ifndef u64_fast
252#define u64_fast uint_fast64_t
253#endif
254
255#ifndef i8_least
256#define i8_least int_least8_t
257#endif
258
259#ifndef i16_least
260#define i16_least int_least16_t
261#endif
262
263#ifndef i32_least
264#define i32_least int_least32_t
265#endif
266
267#ifndef i64_least
268#define i64_least int_least64_t
269#endif
270
271#ifndef u8_least
272#define u8_least uint_least8_t
273#endif
274
275#ifndef u16_least
276#define u16_least uint_least16_t
277#endif
278
279#ifndef u32_least
280#define u32_least uint_least32_t
281#endif
282
283#ifndef u64_least
284#define u64_least uint_least64_t
285#endif
286
287#ifndef i8
288#define i8 int8_t
289#endif
290
291#ifndef i16
292#define i16 int16_t
293#endif
294
295#ifndef i32
296#define i32 int32_t
297#endif
298
299#ifndef i64
300#define i64 int64_t
301#endif
302
303#ifndef u8
304#define u8 uint8_t
305#endif
306
307#ifndef u16
308#define u16 uint16_t
309#endif
310
311#ifndef u32
312#define u32 uint32_t
313#endif
314
315#ifndef u64
316#define u64 uint64_t
317#endif
318
319#ifndef imax
320#define imax intmax_t
321#endif
322
323#ifndef umax
324#define umax uintmax_t
325#endif
326
327#ifndef iptr
328#define iptr intptr_t
329#endif
330
331#ifndef uptr
332#define uptr uintptr_t
333#endif
334
335
336#endif
#define __ae2f_lvcheck_c(v)
#define HAVE_STDINT_H