• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _INTTYPES_H
2 #define _INTTYPES_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <features.h>
9 #include <stdint.h>
10 
11 #define __NEED_wchar_t
12 #include <bits/alltypes.h>
13 
14 typedef struct { intmax_t quot, rem; } imaxdiv_t;
15 
16 intmax_t imaxabs(intmax_t);
17 imaxdiv_t imaxdiv(intmax_t, intmax_t);
18 
19 /**
20  * @ingroup  string
21  * @par Description:
22  * The function shall be equivalent to the strtol(), strtoll(), strtoul(), and strtoull() functions,
23  * except that the initial portion of the string shall be converted to intmax_t representation.
24  *
25  * @attention
26  * <ul>
27  * <li>None.</li>
28  * </ul>
29  *
30  * @retval
31  * #intmax_t The function shall return the converted value, if any.
32  *
33  * @par Errors
34  * <ul>
35  * <li><b>ERANGE</b>: The value to be returned is not representable.</li>
36  * </ul>
37  *
38  * @par Dependency:
39  * <ul><li>inttypes.h</li></ul>
40  *
41  * @see  strtol | strtoul
42  *
43  */
44 intmax_t strtoimax(const char *__restrict, char **__restrict, int);
45 
46 /**
47  * @ingroup  string
48  * @par Description:
49  * The function shall be equivalent to the strtol(), strtoll(), strtoul(), and strtoull() functions,
50  * except that the initial portion of the string shall be converted to uintmax_t representation.
51  *
52  * @attention
53  * <ul>
54  * <li>None.</li>
55  * </ul>
56  *
57  * @retval
58  * #uintmax_t The function shall return the converted value, if any.
59  *
60  * @par Errors
61  * <ul>
62  * <li><b>ERANGE</b>: The value to be returned is not representable.</li>
63  * </ul>
64  *
65  * @par Dependency:
66  * <ul><li>inttypes.h</li></ul>
67  *
68  * @see  strtol | strtoul
69  *
70  */
71 uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
72 
73 intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
74 uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
75 
76 #if UINTPTR_MAX == UINT64_MAX
77 #define __PRI64  "l"
78 #define __PRIPTR "l"
79 #else
80 #define __PRI64  "ll"
81 #define __PRIPTR ""
82 #endif
83 
84 #define PRId8  "d"
85 #define PRId16 "d"
86 #define PRId32 "d"
87 #define PRId64 __PRI64 "d"
88 
89 #define PRIdLEAST8  "d"
90 #define PRIdLEAST16 "d"
91 #define PRIdLEAST32 "d"
92 #define PRIdLEAST64 __PRI64 "d"
93 
94 #define PRIdFAST8  "d"
95 #define PRIdFAST16 "d"
96 #define PRIdFAST32 "d"
97 #define PRIdFAST64 __PRI64 "d"
98 
99 #define PRIi8  "i"
100 #define PRIi16 "i"
101 #define PRIi32 "i"
102 #define PRIi64 __PRI64 "i"
103 
104 #define PRIiLEAST8  "i"
105 #define PRIiLEAST16 "i"
106 #define PRIiLEAST32 "i"
107 #define PRIiLEAST64 __PRI64 "i"
108 
109 #define PRIiFAST8  "i"
110 #define PRIiFAST16 "i"
111 #define PRIiFAST32 "i"
112 #define PRIiFAST64 __PRI64 "i"
113 
114 #define PRIo8  "o"
115 #define PRIo16 "o"
116 #define PRIo32 "o"
117 #define PRIo64 __PRI64 "o"
118 
119 #define PRIoLEAST8  "o"
120 #define PRIoLEAST16 "o"
121 #define PRIoLEAST32 "o"
122 #define PRIoLEAST64 __PRI64 "o"
123 
124 #define PRIoFAST8  "o"
125 #define PRIoFAST16 "o"
126 #define PRIoFAST32 "o"
127 #define PRIoFAST64 __PRI64 "o"
128 
129 #define PRIu8  "u"
130 #define PRIu16 "u"
131 #define PRIu32 "u"
132 #define PRIu64 __PRI64 "u"
133 
134 #define PRIuLEAST8  "u"
135 #define PRIuLEAST16 "u"
136 #define PRIuLEAST32 "u"
137 #define PRIuLEAST64 __PRI64 "u"
138 
139 #define PRIuFAST8  "u"
140 #define PRIuFAST16 "u"
141 #define PRIuFAST32 "u"
142 #define PRIuFAST64 __PRI64 "u"
143 
144 #define PRIx8  "x"
145 #define PRIx16 "x"
146 #define PRIx32 "x"
147 #define PRIx64 __PRI64 "x"
148 
149 #define PRIxLEAST8  "x"
150 #define PRIxLEAST16 "x"
151 #define PRIxLEAST32 "x"
152 #define PRIxLEAST64 __PRI64 "x"
153 
154 #define PRIxFAST8  "x"
155 #define PRIxFAST16 "x"
156 #define PRIxFAST32 "x"
157 #define PRIxFAST64 __PRI64 "x"
158 
159 #define PRIX8  "X"
160 #define PRIX16 "X"
161 #define PRIX32 "X"
162 #define PRIX64 __PRI64 "X"
163 
164 #define PRIXLEAST8  "X"
165 #define PRIXLEAST16 "X"
166 #define PRIXLEAST32 "X"
167 #define PRIXLEAST64 __PRI64 "X"
168 
169 #define PRIXFAST8  "X"
170 #define PRIXFAST16 "X"
171 #define PRIXFAST32 "X"
172 #define PRIXFAST64 __PRI64 "X"
173 
174 #define PRIdMAX __PRI64 "d"
175 #define PRIiMAX __PRI64 "i"
176 #define PRIoMAX __PRI64 "o"
177 #define PRIuMAX __PRI64 "u"
178 #define PRIxMAX __PRI64 "x"
179 #define PRIXMAX __PRI64 "X"
180 
181 #define PRIdPTR __PRIPTR "d"
182 #define PRIiPTR __PRIPTR "i"
183 #define PRIoPTR __PRIPTR "o"
184 #define PRIuPTR __PRIPTR "u"
185 #define PRIxPTR __PRIPTR "x"
186 #define PRIXPTR __PRIPTR "X"
187 
188 #define SCNd8   "hhd"
189 #define SCNd16  "hd"
190 #define SCNd32  "d"
191 #define SCNd64  __PRI64 "d"
192 
193 #define SCNdLEAST8  "hhd"
194 #define SCNdLEAST16 "hd"
195 #define SCNdLEAST32 "d"
196 #define SCNdLEAST64 __PRI64 "d"
197 
198 #define SCNdFAST8  "hhd"
199 #define SCNdFAST16 "d"
200 #define SCNdFAST32 "d"
201 #define SCNdFAST64 __PRI64 "d"
202 
203 #define SCNi8   "hhi"
204 #define SCNi16  "hi"
205 #define SCNi32  "i"
206 #define SCNi64  __PRI64 "i"
207 
208 #define SCNiLEAST8  "hhi"
209 #define SCNiLEAST16 "hi"
210 #define SCNiLEAST32 "i"
211 #define SCNiLEAST64 __PRI64 "i"
212 
213 #define SCNiFAST8  "hhi"
214 #define SCNiFAST16 "i"
215 #define SCNiFAST32 "i"
216 #define SCNiFAST64 __PRI64 "i"
217 
218 #define SCNu8   "hhu"
219 #define SCNu16  "hu"
220 #define SCNu32  "u"
221 #define SCNu64  __PRI64 "u"
222 
223 #define SCNuLEAST8  "hhu"
224 #define SCNuLEAST16 "hu"
225 #define SCNuLEAST32 "u"
226 #define SCNuLEAST64 __PRI64 "u"
227 
228 #define SCNuFAST8 "hhu"
229 #define SCNuFAST16 "u"
230 #define SCNuFAST32 "u"
231 #define SCNuFAST64 __PRI64 "u"
232 
233 #define SCNo8   "hho"
234 #define SCNo16  "ho"
235 #define SCNo32  "o"
236 #define SCNo64  __PRI64 "o"
237 
238 #define SCNoLEAST8  "hho"
239 #define SCNoLEAST16 "ho"
240 #define SCNoLEAST32 "o"
241 #define SCNoLEAST64 __PRI64 "o"
242 
243 #define SCNoFAST8  "hho"
244 #define SCNoFAST16 "o"
245 #define SCNoFAST32 "o"
246 #define SCNoFAST64 __PRI64 "o"
247 
248 #define SCNx8   "hhx"
249 #define SCNx16  "hx"
250 #define SCNx32  "x"
251 #define SCNx64  __PRI64 "x"
252 
253 #define SCNxLEAST8  "hhx"
254 #define SCNxLEAST16 "hx"
255 #define SCNxLEAST32 "x"
256 #define SCNxLEAST64 __PRI64 "x"
257 
258 #define SCNxFAST8  "hhx"
259 #define SCNxFAST16 "x"
260 #define SCNxFAST32 "x"
261 #define SCNxFAST64 __PRI64 "x"
262 
263 #define SCNdMAX __PRI64 "d"
264 #define SCNiMAX __PRI64 "i"
265 #define SCNoMAX __PRI64 "o"
266 #define SCNuMAX __PRI64 "u"
267 #define SCNxMAX __PRI64 "x"
268 
269 #define SCNdPTR __PRIPTR "d"
270 #define SCNiPTR __PRIPTR "i"
271 #define SCNoPTR __PRIPTR "o"
272 #define SCNuPTR __PRIPTR "u"
273 #define SCNxPTR __PRIPTR "x"
274 
275 #ifdef __cplusplus
276 }
277 #endif
278 
279 #endif
280 
281