1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _SYS_STDINT_H_
20 #define _SYS_STDINT_H_
21
22 #include <sys/cdefs.h>
23 #include <machine/_types.h>
24
25 #ifndef __BIT_TYPES_DEFINED__
26 #define __BIT_TYPES_DEFINED__
27 #endif
28
29
30 #ifndef _INT8_T_DEFINED_
31 #define _INT8_T_DEFINED_
32 typedef __int8_t int8_t;
33 #endif
34
35 #ifndef _UINT8_T_DEFINED_
36 #define _UINT8_T_DEFINED_
37 typedef __uint8_t uint8_t;
38 #endif
39
40 #ifndef _INT16_T_DEFINED_
41 #define _INT16_T_DEFINED_
42 typedef __int16_t int16_t;
43 #endif
44
45 #ifndef _UINT16_T_DEFINED_
46 #define _UINT16_T_DEFINED_
47 typedef __uint16_t uint16_t;
48 #endif
49
50 #ifndef _INT32_T_DEFINED_
51 #define _INT32_T_DEFINED_
52 typedef __int32_t int32_t;
53 #endif
54
55 #ifndef _UINT32_T_DEFINED_
56 #define _UINT32_T_DEFINED_
57 typedef __uint32_t uint32_t;
58 #endif
59
60 #ifndef _INT64_T_DEFINED_
61 #define _INT64_T_DEFINED_
62 typedef __int64_t int64_t;
63 #endif
64
65 #ifndef _UINT64_T_DEFINED_
66 #define _UINT64_T_DEFINED_
67 typedef __uint64_t uint64_t;
68 #endif
69
70
71 typedef __int_least8_t int_least8_t;
72 typedef __uint_least8_t uint_least8_t;
73 typedef __int_least16_t int_least16_t;
74 typedef __uint_least16_t uint_least16_t;
75 typedef __int_least32_t int_least32_t;
76 typedef __uint_least32_t uint_least32_t;
77 typedef __int_least64_t int_least64_t;
78 typedef __uint_least64_t uint_least64_t;
79
80
81 typedef __int_fast8_t int_fast8_t;
82 typedef __uint_fast8_t uint_fast8_t;
83 typedef __int_fast16_t int_fast16_t;
84 typedef __uint_fast16_t uint_fast16_t;
85 typedef __int_fast32_t int_fast32_t;
86 typedef __uint_fast32_t uint_fast32_t;
87 typedef __int_fast64_t int_fast64_t;
88 typedef __uint_fast64_t uint_fast64_t;
89
90
91 typedef __intptr_t intptr_t;
92 typedef __uintptr_t uintptr_t;
93
94
95 typedef __intmax_t intmax_t;
96 typedef __uintmax_t uintmax_t;
97
98 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
99
100
101
102
103
104
105
106
107 #define INT8_MIN (-0x7f - 1)
108 #define INT16_MIN (-0x7fff - 1)
109 #define INT32_MIN (-0x7fffffff - 1)
110 #define INT64_MIN (-0x7fffffffffffffffLL - 1)
111
112 #define INT8_MAX 0x7f
113 #define INT16_MAX 0x7fff
114 #define INT32_MAX 0x7fffffff
115 #define INT64_MAX 0x7fffffffffffffffLL
116
117 #define UINT8_MAX 0xff
118 #define UINT16_MAX 0xffff
119 #define UINT32_MAX 0xffffffffU
120 #define UINT64_MAX 0xffffffffffffffffULL
121
122
123 #define INT_LEAST8_MIN INT8_MIN
124 #define INT_LEAST16_MIN INT16_MIN
125 #define INT_LEAST32_MIN INT32_MIN
126 #define INT_LEAST64_MIN INT64_MIN
127
128 #define INT_LEAST8_MAX INT8_MAX
129 #define INT_LEAST16_MAX INT16_MAX
130 #define INT_LEAST32_MAX INT32_MAX
131 #define INT_LEAST64_MAX INT64_MAX
132
133 #define UINT_LEAST8_MAX UINT8_MAX
134 #define UINT_LEAST16_MAX UINT16_MAX
135 #define UINT_LEAST32_MAX UINT32_MAX
136 #define UINT_LEAST64_MAX UINT64_MAX
137
138
139 #define INT_FAST8_MIN INT8_MIN
140 #define INT_FAST16_MIN INT16_MIN
141 #define INT_FAST32_MIN INT32_MIN
142 #define INT_FAST64_MIN INT64_MIN
143
144 #define INT_FAST8_MAX INT8_MAX
145 #define INT_FAST16_MAX INT16_MAX
146 #define INT_FAST32_MAX INT32_MAX
147 #define INT_FAST64_MAX INT64_MAX
148
149 #define UINT_FAST8_MAX UINT8_MAX
150 #define UINT_FAST16_MAX UINT16_MAX
151 #define UINT_FAST32_MAX UINT32_MAX
152 #define UINT_FAST64_MAX UINT64_MAX
153
154
155 #ifdef __LP64__
156 #define INTPTR_MIN INT64_MIN
157 #define INTPTR_MAX INT64_MAX
158 #define UINTPTR_MAX UINT64_MAX
159 #else
160 #define INTPTR_MIN INT32_MIN
161 #define INTPTR_MAX INT32_MAX
162 #define UINTPTR_MAX UINT32_MAX
163 #endif
164
165
166 #define INTMAX_MIN INT64_MIN
167 #define INTMAX_MAX INT64_MAX
168 #define UINTMAX_MAX UINT64_MAX
169
170
171
172
173
174
175
176
177
178
179 #define PTRDIFF_MIN INTPTR_MIN
180 #define PTRDIFF_MAX INTPTR_MAX
181
182
183 #define SIG_ATOMIC_MIN INT32_MIN
184 #define SIG_ATOMIC_MAX INT32_MAX
185
186
187 #ifndef SIZE_MAX
188 #define SIZE_MAX UINTPTR_MAX
189 #endif
190
191
192 #define WCHAR_MIN INT32_MIN
193 #define WCHAR_MAX INT32_MAX
194
195
196 #define WINT_MIN INT32_MIN
197 #define WINT_MAX INT32_MAX
198
199 #endif
200
201 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
202
203
204
205
206
207
208
209
210
211
212
213 #define INT8_C(_c) (_c)
214 #define INT16_C(_c) (_c)
215 #define INT32_C(_c) (_c)
216 #define INT64_C(_c) __CONCAT(_c, LL)
217
218 #define UINT8_C(_c) (_c)
219 #define UINT16_C(_c) (_c)
220 #define UINT32_C(_c) __CONCAT(_c, U)
221 #define UINT64_C(_c) __CONCAT(_c, ULL)
222
223
224 #define INTMAX_C(_c) __CONCAT(_c, LL)
225 #define UINTMAX_C(_c) __CONCAT(_c, ULL)
226
227 #endif
228
229 #endif