1 /* 7.8 Format conversion of integer types <inttypes.h> */
19 #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
21 /* 7.8.1 Macros for format specifiers
23 * MS runtime does not yet understand C9x standard "ll"
24 * length specifier. It appears to treat "ll" as "l".
25 * The non-standard I64 length specifier causes warning in GCC,
26 * but understood by MS runtime functions.
29 /* fprintf macros for signed types */
35 #define PRIdLEAST8 "d"
36 #define PRIdLEAST16 "d"
37 #define PRIdLEAST32 "d"
38 #define PRIdLEAST64 "I64d"
41 #define PRIdFAST16 "d"
42 #define PRIdFAST32 "d"
43 #define PRIdFAST64 "I64d"
45 #define PRIdMAX "I64d"
53 #define PRIiLEAST8 "i"
54 #define PRIiLEAST16 "i"
55 #define PRIiLEAST32 "i"
56 #define PRIiLEAST64 "I64i"
59 #define PRIiFAST16 "i"
60 #define PRIiFAST32 "i"
61 #define PRIiFAST64 "I64i"
63 #define PRIiMAX "I64i"
71 #define PRIoLEAST8 "o"
72 #define PRIoLEAST16 "o"
73 #define PRIoLEAST32 "o"
74 #define PRIoLEAST64 "I64o"
77 #define PRIoFAST16 "o"
78 #define PRIoFAST32 "o"
79 #define PRIoFAST64 "I64o"
81 #define PRIoMAX "I64o"
85 /* fprintf macros for unsigned types */
92 #define PRIuLEAST8 "u"
93 #define PRIuLEAST16 "u"
94 #define PRIuLEAST32 "u"
95 #define PRIuLEAST64 "I64u"
98 #define PRIuFAST16 "u"
99 #define PRIuFAST32 "u"
100 #define PRIuFAST64 "I64u"
102 #define PRIuMAX "I64u"
108 #define PRIx64 "I64x"
110 #define PRIxLEAST8 "x"
111 #define PRIxLEAST16 "x"
112 #define PRIxLEAST32 "x"
113 #define PRIxLEAST64 "I64x"
115 #define PRIxFAST8 "x"
116 #define PRIxFAST16 "x"
117 #define PRIxFAST32 "x"
118 #define PRIxFAST64 "I64x"
120 #define PRIxMAX "I64x"
126 #define PRIX64 "I64X"
128 #define PRIXLEAST8 "X"
129 #define PRIXLEAST16 "X"
130 #define PRIXLEAST32 "X"
131 #define PRIXLEAST64 "I64X"
133 #define PRIXFAST8 "X"
134 #define PRIXFAST16 "X"
135 #define PRIXFAST32 "X"
136 #define PRIXFAST64 "I64X"
138 #define PRIXMAX "I64X"
142 * fscanf macros for signed int types
143 * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
144 * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
145 * no length identifiers
150 #define SCNd64 "I64d"
152 #define SCNdLEAST16 "hd"
153 #define SCNdLEAST32 "d"
154 #define SCNdLEAST64 "I64d"
156 #define SCNdFAST16 "hd"
157 #define SCNdFAST32 "d"
158 #define SCNdFAST64 "I64d"
160 #define SCNdMAX "I64d"
165 #define SCNi64 "I64i"
167 #define SCNiLEAST16 "hi"
168 #define SCNiLEAST32 "i"
169 #define SCNiLEAST64 "I64i"
171 #define SCNiFAST16 "hi"
172 #define SCNiFAST32 "i"
173 #define SCNiFAST64 "I64i"
175 #define SCNiMAX "I64i"
180 #define SCNo64 "I64o"
182 #define SCNoLEAST16 "ho"
183 #define SCNoLEAST32 "o"
184 #define SCNoLEAST64 "I64o"
186 #define SCNoFAST16 "ho"
187 #define SCNoFAST32 "o"
188 #define SCNoFAST64 "I64o"
190 #define SCNoMAX "I64o"
195 #define SCNx64 "I64x"
197 #define SCNxLEAST16 "hx"
198 #define SCNxLEAST32 "x"
199 #define SCNxLEAST64 "I64x"
201 #define SCNxFAST16 "hx"
202 #define SCNxFAST32 "x"
203 #define SCNxFAST64 "I64x"
205 #define SCNxMAX "I64x"
209 /* fscanf macros for unsigned int types */
213 #define SCNu64 "I64u"
215 #define SCNuLEAST16 "hu"
216 #define SCNuLEAST32 "u"
217 #define SCNuLEAST64 "I64u"
219 #define SCNuFAST16 "hu"
220 #define SCNuFAST32 "u"
221 #define SCNuFAST64 "I64u"
223 #define SCNuMAX "I64u"
226 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
228 * no length modifier for char types prior to C9x
229 * MS runtime scanf appears to treat "hh" as "h"
234 #define SCNdLEAST8 "hhd"
235 #define SCNdFAST8 "hhd"
238 #define SCNiLEAST8 "hhi"
239 #define SCNiFAST8 "hhi"
242 #define SCNoLEAST8 "hho"
243 #define SCNoFAST8 "hho"
246 #define SCNxLEAST8 "hhx"
247 #define SCNxFAST8 "hhx"
251 #define SCNuLEAST8 "hhu"
252 #define SCNuFAST8 "hhu"
253 #endif /* __STDC_VERSION__ >= 199901 */
255 #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
257 extern inline intmax_t imaxabs (intmax_t j
)
258 {return (j
>= 0 ? j
: -j
);}
259 imaxdiv_t
imaxdiv (intmax_t numer
, intmax_t denom
);
261 /* 7.8.2 Conversion functions for greatest-width integer types */
263 intmax_t strtoimax (const char* __restrict__ nptr
, char** __restrict__ endptr
, int base
);
264 uintmax_t strtoumax (const char* __restrict__ nptr
, char** __restrict__ endptr
, int base
);
266 intmax_t wcstoimax (const wchar_t* __restrict__ nptr
, wchar_t** __restrict__ endptr
,
268 uintmax_t wcstoumax (const wchar_t* __restrict__ nptr
, wchar_t** __restrict__ endptr
,
275 #endif /* ndef _INTTYPES_H */