webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Source
ThirdParty
ANGLE
src
tests
third_party
rapidjson
include
rapidjson
msinttypes
inttypes.h
Go to the documentation of this file.
1
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
2
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3
//
4
// Copyright (c) 2006-2013 Alexander Chemeris
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are met:
8
//
9
// 1. Redistributions of source code must retain the above copyright notice,
10
// this list of conditions and the following disclaimer.
11
//
12
// 2. Redistributions in binary form must reproduce the above copyright
13
// notice, this list of conditions and the following disclaimer in the
14
// documentation and/or other materials provided with the distribution.
15
//
16
// 3. Neither the name of the product nor the names of its contributors may
17
// be used to endorse or promote products derived from this software
18
// without specific prior written permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
23
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
//
32
33
#ifndef _MSC_VER // [
34
#error "Use this header only with Microsoft Visual C++ compilers!"
35
#endif // _MSC_VER ]
36
37
#ifndef _MSC_INTTYPES_H_ // [
38
#define _MSC_INTTYPES_H_
39
40
#if _MSC_VER > 1000
41
#pragma once
42
#endif
43
44
#include "
stdint.h
"
45
46
// miloyip: VC supports inttypes.h since VC2013
47
#if _MSC_VER >= 1800
48
#include <
inttypes.h
>
49
#else
50
51
// 7.8 Format conversion of integer types
52
53
typedef
struct
{
54
intmax_t
quot
;
55
intmax_t
rem
;
56
}
imaxdiv_t
;
57
58
// 7.8.1 Macros for format specifiers
59
60
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
61
62
// The fprintf macros for signed integers are:
63
#define PRId8 "d"
64
#define PRIi8 "i"
65
#define PRIdLEAST8 "d"
66
#define PRIiLEAST8 "i"
67
#define PRIdFAST8 "d"
68
#define PRIiFAST8 "i"
69
70
#define PRId16 "hd"
71
#define PRIi16 "hi"
72
#define PRIdLEAST16 "hd"
73
#define PRIiLEAST16 "hi"
74
#define PRIdFAST16 "hd"
75
#define PRIiFAST16 "hi"
76
77
#define PRId32 "I32d"
78
#define PRIi32 "I32i"
79
#define PRIdLEAST32 "I32d"
80
#define PRIiLEAST32 "I32i"
81
#define PRIdFAST32 "I32d"
82
#define PRIiFAST32 "I32i"
83
84
#define PRId64 "I64d"
85
#define PRIi64 "I64i"
86
#define PRIdLEAST64 "I64d"
87
#define PRIiLEAST64 "I64i"
88
#define PRIdFAST64 "I64d"
89
#define PRIiFAST64 "I64i"
90
91
#define PRIdMAX "I64d"
92
#define PRIiMAX "I64i"
93
94
#define PRIdPTR "Id"
95
#define PRIiPTR "Ii"
96
97
// The fprintf macros for unsigned integers are:
98
#define PRIo8 "o"
99
#define PRIu8 "u"
100
#define PRIx8 "x"
101
#define PRIX8 "X"
102
#define PRIoLEAST8 "o"
103
#define PRIuLEAST8 "u"
104
#define PRIxLEAST8 "x"
105
#define PRIXLEAST8 "X"
106
#define PRIoFAST8 "o"
107
#define PRIuFAST8 "u"
108
#define PRIxFAST8 "x"
109
#define PRIXFAST8 "X"
110
111
#define PRIo16 "ho"
112
#define PRIu16 "hu"
113
#define PRIx16 "hx"
114
#define PRIX16 "hX"
115
#define PRIoLEAST16 "ho"
116
#define PRIuLEAST16 "hu"
117
#define PRIxLEAST16 "hx"
118
#define PRIXLEAST16 "hX"
119
#define PRIoFAST16 "ho"
120
#define PRIuFAST16 "hu"
121
#define PRIxFAST16 "hx"
122
#define PRIXFAST16 "hX"
123
124
#define PRIo32 "I32o"
125
#define PRIu32 "I32u"
126
#define PRIx32 "I32x"
127
#define PRIX32 "I32X"
128
#define PRIoLEAST32 "I32o"
129
#define PRIuLEAST32 "I32u"
130
#define PRIxLEAST32 "I32x"
131
#define PRIXLEAST32 "I32X"
132
#define PRIoFAST32 "I32o"
133
#define PRIuFAST32 "I32u"
134
#define PRIxFAST32 "I32x"
135
#define PRIXFAST32 "I32X"
136
137
#define PRIo64 "I64o"
138
#define PRIu64 "I64u"
139
#define PRIx64 "I64x"
140
#define PRIX64 "I64X"
141
#define PRIoLEAST64 "I64o"
142
#define PRIuLEAST64 "I64u"
143
#define PRIxLEAST64 "I64x"
144
#define PRIXLEAST64 "I64X"
145
#define PRIoFAST64 "I64o"
146
#define PRIuFAST64 "I64u"
147
#define PRIxFAST64 "I64x"
148
#define PRIXFAST64 "I64X"
149
150
#define PRIoMAX "I64o"
151
#define PRIuMAX "I64u"
152
#define PRIxMAX "I64x"
153
#define PRIXMAX "I64X"
154
155
#define PRIoPTR "Io"
156
#define PRIuPTR "Iu"
157
#define PRIxPTR "Ix"
158
#define PRIXPTR "IX"
159
160
// The fscanf macros for signed integers are:
161
#define SCNd8 "d"
162
#define SCNi8 "i"
163
#define SCNdLEAST8 "d"
164
#define SCNiLEAST8 "i"
165
#define SCNdFAST8 "d"
166
#define SCNiFAST8 "i"
167
168
#define SCNd16 "hd"
169
#define SCNi16 "hi"
170
#define SCNdLEAST16 "hd"
171
#define SCNiLEAST16 "hi"
172
#define SCNdFAST16 "hd"
173
#define SCNiFAST16 "hi"
174
175
#define SCNd32 "ld"
176
#define SCNi32 "li"
177
#define SCNdLEAST32 "ld"
178
#define SCNiLEAST32 "li"
179
#define SCNdFAST32 "ld"
180
#define SCNiFAST32 "li"
181
182
#define SCNd64 "I64d"
183
#define SCNi64 "I64i"
184
#define SCNdLEAST64 "I64d"
185
#define SCNiLEAST64 "I64i"
186
#define SCNdFAST64 "I64d"
187
#define SCNiFAST64 "I64i"
188
189
#define SCNdMAX "I64d"
190
#define SCNiMAX "I64i"
191
192
#ifdef _WIN64 // [
193
# define SCNdPTR "I64d"
194
# define SCNiPTR "I64i"
195
#else // _WIN64 ][
196
# define SCNdPTR "ld"
197
# define SCNiPTR "li"
198
#endif // _WIN64 ]
199
200
// The fscanf macros for unsigned integers are:
201
#define SCNo8 "o"
202
#define SCNu8 "u"
203
#define SCNx8 "x"
204
#define SCNX8 "X"
205
#define SCNoLEAST8 "o"
206
#define SCNuLEAST8 "u"
207
#define SCNxLEAST8 "x"
208
#define SCNXLEAST8 "X"
209
#define SCNoFAST8 "o"
210
#define SCNuFAST8 "u"
211
#define SCNxFAST8 "x"
212
#define SCNXFAST8 "X"
213
214
#define SCNo16 "ho"
215
#define SCNu16 "hu"
216
#define SCNx16 "hx"
217
#define SCNX16 "hX"
218
#define SCNoLEAST16 "ho"
219
#define SCNuLEAST16 "hu"
220
#define SCNxLEAST16 "hx"
221
#define SCNXLEAST16 "hX"
222
#define SCNoFAST16 "ho"
223
#define SCNuFAST16 "hu"
224
#define SCNxFAST16 "hx"
225
#define SCNXFAST16 "hX"
226
227
#define SCNo32 "lo"
228
#define SCNu32 "lu"
229
#define SCNx32 "lx"
230
#define SCNX32 "lX"
231
#define SCNoLEAST32 "lo"
232
#define SCNuLEAST32 "lu"
233
#define SCNxLEAST32 "lx"
234
#define SCNXLEAST32 "lX"
235
#define SCNoFAST32 "lo"
236
#define SCNuFAST32 "lu"
237
#define SCNxFAST32 "lx"
238
#define SCNXFAST32 "lX"
239
240
#define SCNo64 "I64o"
241
#define SCNu64 "I64u"
242
#define SCNx64 "I64x"
243
#define SCNX64 "I64X"
244
#define SCNoLEAST64 "I64o"
245
#define SCNuLEAST64 "I64u"
246
#define SCNxLEAST64 "I64x"
247
#define SCNXLEAST64 "I64X"
248
#define SCNoFAST64 "I64o"
249
#define SCNuFAST64 "I64u"
250
#define SCNxFAST64 "I64x"
251
#define SCNXFAST64 "I64X"
252
253
#define SCNoMAX "I64o"
254
#define SCNuMAX "I64u"
255
#define SCNxMAX "I64x"
256
#define SCNXMAX "I64X"
257
258
#ifdef _WIN64 // [
259
# define SCNoPTR "I64o"
260
# define SCNuPTR "I64u"
261
# define SCNxPTR "I64x"
262
# define SCNXPTR "I64X"
263
#else // _WIN64 ][
264
# define SCNoPTR "lo"
265
# define SCNuPTR "lu"
266
# define SCNxPTR "lx"
267
# define SCNXPTR "lX"
268
#endif // _WIN64 ]
269
270
#endif // __STDC_FORMAT_MACROS ]
271
272
// 7.8.2 Functions for greatest-width integer types
273
274
// 7.8.2.1 The imaxabs function
275
#define imaxabs _abs64
276
277
// 7.8.2.2 The imaxdiv function
278
279
// This is modified version of div() function from Microsoft's div.c found
280
// in %MSVC.NET%\crt\src\div.c
281
#ifdef STATIC_IMAXDIV // [
282
static
283
#else // STATIC_IMAXDIV ][
284
_inline
285
#endif // STATIC_IMAXDIV ]
286
imaxdiv_t
__cdecl
imaxdiv
(
intmax_t
numer,
intmax_t
denom)
287
{
288
imaxdiv_t
result
;
289
290
result.
quot
= numer / denom;
291
result.
rem
= numer % denom;
292
293
if
(numer < 0 && result.rem > 0) {
294
// did division wrong; must fix up
295
++result.
quot
;
296
result.
rem
-= denom;
297
}
298
299
return
result
;
300
}
301
302
// 7.8.2.3 The strtoimax and strtoumax functions
303
#define strtoimax _strtoi64
304
#define strtoumax _strtoui64
305
306
// 7.8.2.4 The wcstoimax and wcstoumax functions
307
#define wcstoimax _wcstoi64
308
#define wcstoumax _wcstoui64
309
310
#endif // _MSC_VER >= 1800
311
312
#endif // _MSC_INTTYPES_H_ ]
intmax_t
int64_t intmax_t
Definition:
stdint.h:165
__cdecl
__cdecl
Definition:
AVFoundationCFSoftLinking.h:51
imaxdiv_t
Definition:
inttypes.h:53
imaxdiv
_inline imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
Definition:
inttypes.h:286
inttypes.h
imaxdiv_t::rem
intmax_t rem
Definition:
inttypes.h:55
imaxdiv_t::quot
intmax_t quot
Definition:
inttypes.h:54
stdint.h
result
result
Definition:
target-blank-opener-post-window.php:5
Generated by
1.8.13