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