1 /* 7.8 Format conversion of integer types <inttypes.h> */
20 #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
22 /* 7.8.1 Macros for format specifiers
24 * MS runtime does not yet understand C9x standard "ll"
25 * length specifier. It appears to treat "ll" as "l".
26 * The non-standard I64 length specifier causes warning in GCC,
27 * but understood by MS runtime functions.
30 /* fprintf macros for signed types */
36 #define PRIdLEAST8 "d"
37 #define PRIdLEAST16 "d"
38 #define PRIdLEAST32 "d"
39 #define PRIdLEAST64 "I64d"
42 #define PRIdFAST16 "d"
43 #define PRIdFAST32 "d"
44 #define PRIdFAST64 "I64d"
46 #define PRIdMAX "I64d"
54 #define PRIiLEAST8 "i"
55 #define PRIiLEAST16 "i"
56 #define PRIiLEAST32 "i"
57 #define PRIiLEAST64 "I64i"
60 #define PRIiFAST16 "i"
61 #define PRIiFAST32 "i"
62 #define PRIiFAST64 "I64i"
64 #define PRIiMAX "I64i"
72 #define PRIoLEAST8 "o"
73 #define PRIoLEAST16 "o"
74 #define PRIoLEAST32 "o"
75 #define PRIoLEAST64 "I64o"
78 #define PRIoFAST16 "o"
79 #define PRIoFAST32 "o"
80 #define PRIoFAST64 "I64o"
82 #define PRIoMAX "I64o"
86 /* fprintf macros for unsigned types */
93 #define PRIuLEAST8 "u"
94 #define PRIuLEAST16 "u"
95 #define PRIuLEAST32 "u"
96 #define PRIuLEAST64 "I64u"
99 #define PRIuFAST16 "u"
100 #define PRIuFAST32 "u"
101 #define PRIuFAST64 "I64u"
103 #define PRIuMAX "I64u"
109 #define PRIx64 "I64x"
111 #define PRIxLEAST8 "x"
112 #define PRIxLEAST16 "x"
113 #define PRIxLEAST32 "x"
114 #define PRIxLEAST64 "I64x"
116 #define PRIxFAST8 "x"
117 #define PRIxFAST16 "x"
118 #define PRIxFAST32 "x"
119 #define PRIxFAST64 "I64x"
121 #define PRIxMAX "I64x"
127 #define PRIX64 "I64X"
129 #define PRIXLEAST8 "X"
130 #define PRIXLEAST16 "X"
131 #define PRIXLEAST32 "X"
132 #define PRIXLEAST64 "I64X"
134 #define PRIXFAST8 "X"
135 #define PRIXFAST16 "X"
136 #define PRIXFAST32 "X"
137 #define PRIXFAST64 "I64X"
139 #define PRIXMAX "I64X"
143 * fscanf macros for signed int types
144 * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
145 * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
146 * no length identifiers
151 #define SCNd64 "I64d"
153 #define SCNdLEAST16 "hd"
154 #define SCNdLEAST32 "d"
155 #define SCNdLEAST64 "I64d"
157 #define SCNdFAST16 "hd"
158 #define SCNdFAST32 "d"
159 #define SCNdFAST64 "I64d"
161 #define SCNdMAX "I64d"
166 #define SCNi64 "I64i"
168 #define SCNiLEAST16 "hi"
169 #define SCNiLEAST32 "i"
170 #define SCNiLEAST64 "I64i"
172 #define SCNiFAST16 "hi"
173 #define SCNiFAST32 "i"
174 #define SCNiFAST64 "I64i"
176 #define SCNiMAX "I64i"
181 #define SCNo64 "I64o"
183 #define SCNoLEAST16 "ho"
184 #define SCNoLEAST32 "o"
185 #define SCNoLEAST64 "I64o"
187 #define SCNoFAST16 "ho"
188 #define SCNoFAST32 "o"
189 #define SCNoFAST64 "I64o"
191 #define SCNoMAX "I64o"
196 #define SCNx64 "I64x"
198 #define SCNxLEAST16 "hx"
199 #define SCNxLEAST32 "x"
200 #define SCNxLEAST64 "I64x"
202 #define SCNxFAST16 "hx"
203 #define SCNxFAST32 "x"
204 #define SCNxFAST64 "I64x"
206 #define SCNxMAX "I64x"
210 /* fscanf macros for unsigned int types */
214 #define SCNu64 "I64u"
216 #define SCNuLEAST16 "hu"
217 #define SCNuLEAST32 "u"
218 #define SCNuLEAST64 "I64u"
220 #define SCNuFAST16 "hu"
221 #define SCNuFAST32 "u"
222 #define SCNuFAST64 "I64u"
224 #define SCNuMAX "I64u"
227 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
229 * no length modifier for char types prior to C9x
230 * MS runtime scanf appears to treat "hh" as "h"
235 #define SCNdLEAST8 "hhd"
236 #define SCNdFAST8 "hhd"
239 #define SCNiLEAST8 "hhi"
240 #define SCNiFAST8 "hhi"
243 #define SCNoLEAST8 "hho"
244 #define SCNoFAST8 "hho"
247 #define SCNxLEAST8 "hhx"
248 #define SCNxFAST8 "hhx"
252 #define SCNuLEAST8 "hhu"
253 #define SCNuFAST8 "hhu"
254 #endif /* __STDC_VERSION__ >= 199901 */
256 #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
258 __CRT_INLINE
intmax_t __cdecl
imaxabs (intmax_t j
)
259 {return (j
>= 0 ? j
: -j
);}
260 imaxdiv_t __cdecl
imaxdiv (intmax_t numer
, intmax_t denom
);
262 /* 7.8.2 Conversion functions for greatest-width integer types */
264 intmax_t __cdecl
strtoimax (const char* __restrict__ nptr
,
265 char** __restrict__ endptr
, int base
);
266 uintmax_t __cdecl
strtoumax (const char* __restrict__ nptr
,
267 char** __restrict__ endptr
, int base
);
269 intmax_t __cdecl
wcstoimax (const wchar_t* __restrict__ nptr
,
270 wchar_t** __restrict__ endptr
, int base
);
271 uintmax_t __cdecl
wcstoumax (const wchar_t* __restrict__ nptr
,
272 wchar_t** __restrict__ endptr
, int base
);
278 #endif /* ndef _INTTYPES_H */