Darwin: Clean up tabs
[libusbx.git] / msvc / inttypes.h
blob289bb50b4d542a57b390a5df7c7cd054a242953e
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file was original part of the w64 mingw-runtime package.
4 */
6 /*
7 * THIS SOFTWARE IS NOT COPYRIGHTED
9 * Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com>
11 * This source code is offered for use in the public domain. You may
12 * use, modify or distribute it freely.
14 * This code is distributed in the hope that it will be useful but
15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16 * DISCLAIMED. This includes but is not limited to warranties of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * Date: 2010-04-02
22 #ifndef _MSC_VER
23 #error This header should only be used with Microsoft compilers
24 #endif
26 /* 7.8 Format conversion of integer types <inttypes.h> */
28 #ifndef _INTTYPES_H_
29 #define _INTTYPES_H_
31 #include <stdint.h>
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 typedef struct {
38 intmax_t quot;
39 intmax_t rem;
40 } imaxdiv_t;
43 /* 7.8.1 Macros for format specifiers
45 * MS runtime does not yet understand C9x standard "ll"
46 * length specifier. It appears to treat "ll" as "l".
47 * The non-standard I64 length specifier causes warning in GCC,
48 * but understood by MS runtime functions.
51 /* fprintf macros for signed types */
52 #define PRId8 "d"
53 #define PRId16 "d"
54 #define PRId32 "d"
55 #define PRId64 "I64d"
57 #define PRIdLEAST8 "d"
58 #define PRIdLEAST16 "d"
59 #define PRIdLEAST32 "d"
60 #define PRIdLEAST64 "I64d"
62 #define PRIdFAST8 "d"
63 #define PRIdFAST16 "d"
64 #define PRIdFAST32 "d"
65 #define PRIdFAST64 "I64d"
67 #define PRIdMAX "I64d"
69 #define PRIi8 "i"
70 #define PRIi16 "i"
71 #define PRIi32 "i"
72 #define PRIi64 "I64i"
74 #define PRIiLEAST8 "i"
75 #define PRIiLEAST16 "i"
76 #define PRIiLEAST32 "i"
77 #define PRIiLEAST64 "I64i"
79 #define PRIiFAST8 "i"
80 #define PRIiFAST16 "i"
81 #define PRIiFAST32 "i"
82 #define PRIiFAST64 "I64i"
84 #define PRIiMAX "I64i"
86 #define PRIo8 "o"
87 #define PRIo16 "o"
88 #define PRIo32 "o"
89 #define PRIo64 "I64o"
91 #define PRIoLEAST8 "o"
92 #define PRIoLEAST16 "o"
93 #define PRIoLEAST32 "o"
94 #define PRIoLEAST64 "I64o"
96 #define PRIoFAST8 "o"
97 #define PRIoFAST16 "o"
98 #define PRIoFAST32 "o"
99 #define PRIoFAST64 "I64o"
101 #define PRIoMAX "I64o"
103 /* fprintf macros for unsigned types */
104 #define PRIu8 "u"
105 #define PRIu16 "u"
106 #define PRIu32 "u"
107 #define PRIu64 "I64u"
110 #define PRIuLEAST8 "u"
111 #define PRIuLEAST16 "u"
112 #define PRIuLEAST32 "u"
113 #define PRIuLEAST64 "I64u"
115 #define PRIuFAST8 "u"
116 #define PRIuFAST16 "u"
117 #define PRIuFAST32 "u"
118 #define PRIuFAST64 "I64u"
120 #define PRIuMAX "I64u"
122 #define PRIx8 "x"
123 #define PRIx16 "x"
124 #define PRIx32 "x"
125 #define PRIx64 "I64x"
127 #define PRIxLEAST8 "x"
128 #define PRIxLEAST16 "x"
129 #define PRIxLEAST32 "x"
130 #define PRIxLEAST64 "I64x"
132 #define PRIxFAST8 "x"
133 #define PRIxFAST16 "x"
134 #define PRIxFAST32 "x"
135 #define PRIxFAST64 "I64x"
137 #define PRIxMAX "I64x"
139 #define PRIX8 "X"
140 #define PRIX16 "X"
141 #define PRIX32 "X"
142 #define PRIX64 "I64X"
144 #define PRIXLEAST8 "X"
145 #define PRIXLEAST16 "X"
146 #define PRIXLEAST32 "X"
147 #define PRIXLEAST64 "I64X"
149 #define PRIXFAST8 "X"
150 #define PRIXFAST16 "X"
151 #define PRIXFAST32 "X"
152 #define PRIXFAST64 "I64X"
154 #define PRIXMAX "I64X"
157 * fscanf macros for signed int types
158 * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
159 * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
160 * no length identifiers
163 #define SCNd16 "hd"
164 #define SCNd32 "d"
165 #define SCNd64 "I64d"
167 #define SCNdLEAST16 "hd"
168 #define SCNdLEAST32 "d"
169 #define SCNdLEAST64 "I64d"
171 #define SCNdFAST16 "hd"
172 #define SCNdFAST32 "d"
173 #define SCNdFAST64 "I64d"
175 #define SCNdMAX "I64d"
177 #define SCNi16 "hi"
178 #define SCNi32 "i"
179 #define SCNi64 "I64i"
181 #define SCNiLEAST16 "hi"
182 #define SCNiLEAST32 "i"
183 #define SCNiLEAST64 "I64i"
185 #define SCNiFAST16 "hi"
186 #define SCNiFAST32 "i"
187 #define SCNiFAST64 "I64i"
189 #define SCNiMAX "I64i"
191 #define SCNo16 "ho"
192 #define SCNo32 "o"
193 #define SCNo64 "I64o"
195 #define SCNoLEAST16 "ho"
196 #define SCNoLEAST32 "o"
197 #define SCNoLEAST64 "I64o"
199 #define SCNoFAST16 "ho"
200 #define SCNoFAST32 "o"
201 #define SCNoFAST64 "I64o"
203 #define SCNoMAX "I64o"
205 #define SCNx16 "hx"
206 #define SCNx32 "x"
207 #define SCNx64 "I64x"
209 #define SCNxLEAST16 "hx"
210 #define SCNxLEAST32 "x"
211 #define SCNxLEAST64 "I64x"
213 #define SCNxFAST16 "hx"
214 #define SCNxFAST32 "x"
215 #define SCNxFAST64 "I64x"
217 #define SCNxMAX "I64x"
219 /* fscanf macros for unsigned int types */
221 #define SCNu16 "hu"
222 #define SCNu32 "u"
223 #define SCNu64 "I64u"
225 #define SCNuLEAST16 "hu"
226 #define SCNuLEAST32 "u"
227 #define SCNuLEAST64 "I64u"
229 #define SCNuFAST16 "hu"
230 #define SCNuFAST32 "u"
231 #define SCNuFAST64 "I64u"
233 #define SCNuMAX "I64u"
235 #ifdef _WIN64
236 #define PRIdPTR "I64d"
237 #define PRIiPTR "I64i"
238 #define PRIoPTR "I64o"
239 #define PRIuPTR "I64u"
240 #define PRIxPTR "I64x"
241 #define PRIXPTR "I64X"
242 #define SCNdPTR "I64d"
243 #define SCNiPTR "I64i"
244 #define SCNoPTR "I64o"
245 #define SCNxPTR "I64x"
246 #define SCNuPTR "I64u"
247 #else
248 #define PRIdPTR "d"
249 #define PRIiPTR "i"
250 #define PRIoPTR "o"
251 #define PRIuPTR "u"
252 #define PRIxPTR "x"
253 #define PRIXPTR "X"
254 #define SCNdPTR "d"
255 #define SCNiPTR "i"
256 #define SCNoPTR "o"
257 #define SCNxPTR "x"
258 #define SCNuPTR "u"
259 #endif
261 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
263 * no length modifier for char types prior to C9x
264 * MS runtime scanf appears to treat "hh" as "h"
267 /* signed char */
268 #define SCNd8 "hhd"
269 #define SCNdLEAST8 "hhd"
270 #define SCNdFAST8 "hhd"
272 #define SCNi8 "hhi"
273 #define SCNiLEAST8 "hhi"
274 #define SCNiFAST8 "hhi"
276 #define SCNo8 "hho"
277 #define SCNoLEAST8 "hho"
278 #define SCNoFAST8 "hho"
280 #define SCNx8 "hhx"
281 #define SCNxLEAST8 "hhx"
282 #define SCNxFAST8 "hhx"
284 /* unsigned char */
285 #define SCNu8 "hhu"
286 #define SCNuLEAST8 "hhu"
287 #define SCNuFAST8 "hhu"
288 #endif /* __STDC_VERSION__ >= 199901 */
291 #ifdef __cplusplus
293 #endif
295 #endif /* ndef _INTTYPES_H */