xref: /reactos/sdk/include/ucrt/inttypes.h (revision b09b5584)
1 //
2 // inttypes.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // Various integer format specifier macros for use with the stdio library, and
7 // various integer conversion and manipulation functions.
8 //
9 #pragma once
10 #ifndef _INTTYPES // include guard for 3rd party interop
11 #define _INTTYPES
12 
13 #include <corecrt.h>
14 #include <stdint.h>
15 
16 #pragma warning(push)
17 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
18 _UCRT_DISABLE_CLANG_WARNINGS
19 
20 _CRT_BEGIN_C_HEADER
21 
22 
23 
24 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 //
26 // Types
27 //
28 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29 typedef struct
30 {
31     intmax_t quot;
32     intmax_t rem;
33 } _Lldiv_t;
34 
35 typedef _Lldiv_t imaxdiv_t;
36 
37 
38 
39 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 //
41 // Functions
42 //
43 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 _Check_return_
45 _ACRTIMP intmax_t __cdecl imaxabs(
46     _In_ intmax_t _Number
47     );
48 
49 _Check_return_
50 _ACRTIMP imaxdiv_t __cdecl imaxdiv(
51     _In_ intmax_t _Numerator,
52     _In_ intmax_t _Denominator
53     );
54 
55 _ACRTIMP intmax_t __cdecl strtoimax(
56     _In_z_                   char const* _String,
57     _Out_opt_ _Deref_post_z_ char**      _EndPtr,
58     _In_                     int         _Radix
59     );
60 
61 _ACRTIMP intmax_t __cdecl _strtoimax_l(
62     _In_z_                   char const* _String,
63     _Out_opt_ _Deref_post_z_ char**      _EndPtr,
64     _In_                     int         _Radix,
65     _In_opt_                 _locale_t   _Locale
66     );
67 
68 _ACRTIMP uintmax_t __cdecl strtoumax(
69     _In_z_                   char const* _String,
70     _Out_opt_ _Deref_post_z_ char**      _EndPtr,
71     _In_                     int         _Radix
72     );
73 
74 _ACRTIMP uintmax_t __cdecl _strtoumax_l(
75     _In_z_                   char const* _String,
76     _Out_opt_ _Deref_post_z_ char**      _EndPtr,
77     _In_                     int         _Radix,
78     _In_opt_                 _locale_t   _Locale
79     );
80 
81 _ACRTIMP intmax_t __cdecl wcstoimax(
82     _In_z_                   wchar_t const* _String,
83     _Out_opt_ _Deref_post_z_ wchar_t**      _EndPtr,
84     _In_                     int            _Radix
85     );
86 
87 _ACRTIMP intmax_t __cdecl _wcstoimax_l(
88     _In_z_                   wchar_t const* _String,
89     _Out_opt_ _Deref_post_z_ wchar_t**      _EndPtr,
90     _In_                     int            _Radix,
91     _In_opt_                 _locale_t      _Locale
92     );
93 
94 _ACRTIMP uintmax_t __cdecl wcstoumax(
95     _In_z_                   wchar_t const* _String,
96     _Out_opt_ _Deref_post_z_ wchar_t**      _EndPtr,
97     _In_                     int            _Radix
98     );
99 
100 _ACRTIMP uintmax_t __cdecl _wcstoumax_l(
101     _In_z_                   wchar_t const* _String,
102     _Out_opt_ _Deref_post_z_ wchar_t**      _EndPtr,
103     _In_                     int            _Radix,
104     _In_opt_                 _locale_t      _Locale
105     );
106 
107 
108 
109 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
110 //
111 // Output Format Specifier Macros
112 //
113 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
114 #define PRId8        "hhd"
115 #define PRId16       "hd"
116 #define PRId32       "d"
117 #define PRId64       "lld"
118 #define PRIdLEAST8   PRId8
119 #define PRIdLEAST16  PRId16
120 #define PRIdLEAST32  PRId32
121 #define PRIdLEAST64  PRId64
122 #define PRIdFAST8    PRId8
123 #define PRIdFAST16   PRId32
124 #define PRIdFAST32   PRId32
125 #define PRIdFAST64   PRId64
126 #define PRIdMAX      PRId64
127 #ifdef _WIN64
128     #define PRIdPTR  PRId64
129 #else
130     #define PRIdPTR  PRId32
131 #endif
132 
133 #define PRIi8        "hhi"
134 #define PRIi16       "hi"
135 #define PRIi32       "i"
136 #define PRIi64       "lli"
137 #define PRIiLEAST8   PRIi8
138 #define PRIiLEAST16  PRIi16
139 #define PRIiLEAST32  PRIi32
140 #define PRIiLEAST64  PRIi64
141 #define PRIiFAST8    PRIi8
142 #define PRIiFAST16   PRIi32
143 #define PRIiFAST32   PRIi32
144 #define PRIiFAST64   PRIi64
145 #define PRIiMAX      PRIi64
146 #ifdef _WIN64
147     #define PRIiPTR  PRIi64
148 #else
149     #define PRIiPTR  PRIi32
150 #endif
151 
152 #define PRIo8        "hho"
153 #define PRIo16       "ho"
154 #define PRIo32       "o"
155 #define PRIo64       "llo"
156 #define PRIoLEAST8   PRIo8
157 #define PRIoLEAST16  PRIo16
158 #define PRIoLEAST32  PRIo32
159 #define PRIoLEAST64  PRIo64
160 #define PRIoFAST8    PRIo8
161 #define PRIoFAST16   PRIo32
162 #define PRIoFAST32   PRIo32
163 #define PRIoFAST64   PRIo64
164 #define PRIoMAX      PRIo64
165 #ifdef _WIN64
166     #define PRIoPTR  PRIo64
167 #else
168     #define PRIoPTR  PRIo32
169 #endif
170 
171 #define PRIu8        "hhu"
172 #define PRIu16       "hu"
173 #define PRIu32       "u"
174 #define PRIu64       "llu"
175 #define PRIuLEAST8   PRIu8
176 #define PRIuLEAST16  PRIu16
177 #define PRIuLEAST32  PRIu32
178 #define PRIuLEAST64  PRIu64
179 #define PRIuFAST8    PRIu8
180 #define PRIuFAST16   PRIu32
181 #define PRIuFAST32   PRIu32
182 #define PRIuFAST64   PRIu64
183 #define PRIuMAX      PRIu64
184 #ifdef _WIN64
185     #define PRIuPTR  PRIu64
186 #else
187     #define PRIuPTR  PRIu32
188 #endif
189 
190 #define PRIx8        "hhx"
191 #define PRIx16       "hx"
192 #define PRIx32       "x"
193 #define PRIx64       "llx"
194 #define PRIxLEAST8   PRIx8
195 #define PRIxLEAST16  PRIx16
196 #define PRIxLEAST32  PRIx32
197 #define PRIxLEAST64  PRIx64
198 #define PRIxFAST8    PRIx8
199 #define PRIxFAST16   PRIx32
200 #define PRIxFAST32   PRIx32
201 #define PRIxFAST64   PRIx64
202 #define PRIxMAX      PRIx64
203 #ifdef _WIN64
204     #define PRIxPTR  PRIx64
205 #else
206     #define PRIxPTR  PRIx32
207 #endif
208 
209 #define PRIX8        "hhX"
210 #define PRIX16       "hX"
211 #define PRIX32       "X"
212 #define PRIX64       "llX"
213 #define PRIXLEAST8   PRIX8
214 #define PRIXLEAST16  PRIX16
215 #define PRIXLEAST32  PRIX32
216 #define PRIXLEAST64  PRIX64
217 #define PRIXFAST8    PRIX8
218 #define PRIXFAST16   PRIX32
219 #define PRIXFAST32   PRIX32
220 #define PRIXFAST64   PRIX64
221 #define PRIXMAX      PRIX64
222 #ifdef _WIN64
223     #define PRIXPTR  PRIX64
224 #else
225     #define PRIXPTR  PRIX32
226 #endif
227 
228 
229 
230 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
231 //
232 // Input Format Specifier Macros
233 //
234 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
235 #define SCNd8        "hhd"
236 #define SCNd16       "hd"
237 #define SCNd32       "d"
238 #define SCNd64       "lld"
239 #define SCNdLEAST8   SCNd8
240 #define SCNdLEAST16  SCNd16
241 #define SCNdLEAST32  SCNd32
242 #define SCNdLEAST64  SCNd64
243 #define SCNdFAST8    SCNd8
244 #define SCNdFAST16   SCNd32
245 #define SCNdFAST32   SCNd32
246 #define SCNdFAST64   SCNd64
247 #define SCNdMAX      SCNd64
248 #ifdef _WIN64
249     #define SCNdPTR  SCNd64
250 #else
251     #define SCNdPTR  SCNd32
252 #endif
253 
254 #define SCNi8        "hhi"
255 #define SCNi16       "hi"
256 #define SCNi32       "i"
257 #define SCNi64       "lli"
258 #define SCNiLEAST8   SCNi8
259 #define SCNiLEAST16  SCNi16
260 #define SCNiLEAST32  SCNi32
261 #define SCNiLEAST64  SCNi64
262 #define SCNiFAST8    SCNi8
263 #define SCNiFAST16   SCNi32
264 #define SCNiFAST32   SCNi32
265 #define SCNiFAST64   SCNi64
266 #define SCNiMAX      SCNi64
267 #ifdef _WIN64
268     #define SCNiPTR  SCNi64
269 #else
270     #define SCNiPTR  SCNi32
271 #endif
272 
273 #define SCNo8        "hho"
274 #define SCNo16       "ho"
275 #define SCNo32       "o"
276 #define SCNo64       "llo"
277 #define SCNoLEAST8   SCNo8
278 #define SCNoLEAST16  SCNo16
279 #define SCNoLEAST32  SCNo32
280 #define SCNoLEAST64  SCNo64
281 #define SCNoFAST8    SCNo8
282 #define SCNoFAST16   SCNo32
283 #define SCNoFAST32   SCNo32
284 #define SCNoFAST64   SCNo64
285 #define SCNoMAX      SCNo64
286 #ifdef _WIN64
287     #define SCNoPTR  SCNo64
288 #else
289     #define SCNoPTR  SCNo32
290 #endif
291 
292 #define SCNu8        "hhu"
293 #define SCNu16       "hu"
294 #define SCNu32       "u"
295 #define SCNu64       "llu"
296 #define SCNuLEAST8   SCNu8
297 #define SCNuLEAST16  SCNu16
298 #define SCNuLEAST32  SCNu32
299 #define SCNuLEAST64  SCNu64
300 #define SCNuFAST8    SCNu8
301 #define SCNuFAST16   SCNu32
302 #define SCNuFAST32   SCNu32
303 #define SCNuFAST64   SCNu64
304 #define SCNuMAX      SCNu64
305 #ifdef _WIN64
306     #define SCNuPTR  SCNu64
307 #else
308     #define SCNuPTR  SCNu32
309 #endif
310 
311 #define SCNx8        "hhx"
312 #define SCNx16       "hx"
313 #define SCNx32       "x"
314 #define SCNx64       "llx"
315 #define SCNxLEAST8   SCNx8
316 #define SCNxLEAST16  SCNx16
317 #define SCNxLEAST32  SCNx32
318 #define SCNxLEAST64  SCNx64
319 #define SCNxFAST8    SCNx8
320 #define SCNxFAST16   SCNx32
321 #define SCNxFAST32   SCNx32
322 #define SCNxFAST64   SCNx64
323 #define SCNxMAX      SCNx64
324 #ifdef _WIN64
325     #define SCNxPTR  SCNx64
326 #else
327     #define SCNxPTR  SCNx32
328 #endif
329 
330 
331 
332 _CRT_END_C_HEADER
333 
334 /*
335  * Copyright (c) 1992-2010 by P.J. Plauger.  ALL RIGHTS RESERVED.
336  * Consult your license regarding permissions and restrictions.
337 V5.30:0009 */
338 
339 _UCRT_RESTORE_CLANG_WARNINGS
340 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
341 #endif // _INTTYPES
342