Lines 1-30
Link Here
|
1 |
# Origin: http://www.azillionmonkeys.com/qed/pstdint.h |
1 |
# Origin: http://www.azillionmonkeys.com/qed/pstdint.h |
2 |
# Subject: Update pstdint.h to version 0.1.15.4 |
2 |
# Subject: Update pstdint.h to version 0.1.15.4 |
3 |
|
3 |
|
4 |
--- include/assimp/Compiler/pstdint.h.orig 2015-11-03 18:47:37 UTC |
4 |
--- include/assimp/Compiler/pstdint.h.orig 2016-07-06 18:14:35 UTC |
5 |
+++ include/assimp/Compiler/pstdint.h |
5 |
+++ include/assimp/Compiler/pstdint.h |
6 |
@@ -3,7 +3,7 @@ |
6 |
@@ -1,847 +1,912 @@ |
7 |
* BSD License: |
7 |
-/* A portable stdint.h |
8 |
**************************************************************************** |
8 |
- **************************************************************************** |
9 |
* |
9 |
- * BSD License: |
10 |
- * Copyright (c) 2005-2007 Paul Hsieh |
10 |
- **************************************************************************** |
11 |
+ * Copyright (c) 2005-2016 Paul Hsieh |
11 |
- * |
12 |
* All rights reserved. |
12 |
- * Copyright (c) 2005-2011 Paul Hsieh |
13 |
* |
13 |
- * All rights reserved. |
14 |
* Redistribution and use in source and binary forms, with or without |
14 |
- * |
15 |
@@ -31,7 +31,7 @@ |
15 |
- * Redistribution and use in source and binary forms, with or without |
16 |
* |
16 |
- * modification, are permitted provided that the following conditions |
17 |
**************************************************************************** |
17 |
- * are met: |
18 |
* |
18 |
- * |
19 |
- * Version 0.1.10 |
19 |
- * 1. Redistributions of source code must retain the above copyright |
20 |
+ * Version 0.1.15.4 |
20 |
- * notice, this list of conditions and the following disclaimer. |
21 |
* |
21 |
- * 2. Redistributions in binary form must reproduce the above copyright |
22 |
* The ANSI C standard committee, for the C99 standard, specified the |
22 |
- * notice, this list of conditions and the following disclaimer in the |
23 |
* inclusion of a new standard include file called stdint.h. This is |
23 |
- * documentation and/or other materials provided with the distribution. |
24 |
@@ -42,19 +42,17 @@ |
24 |
- * 3. The name of the author may not be used to endorse or promote products |
25 |
* integer libraries and so on. But for most developers its likely |
25 |
- * derived from this software without specific prior written permission. |
26 |
* useful just for programming sanity. |
26 |
- * |
27 |
* |
27 |
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
|
28 |
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
29 |
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
30 |
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
31 |
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
32 |
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
33 |
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
34 |
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
35 |
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
36 |
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
37 |
- * |
38 |
- **************************************************************************** |
39 |
- * |
40 |
- * Version 0.1.12 |
41 |
- * |
42 |
- * The ANSI C standard committee, for the C99 standard, specified the |
43 |
- * inclusion of a new standard include file called stdint.h. This is |
44 |
- * a very useful and long desired include file which contains several |
45 |
- * very precise definitions for integer scalar types that is |
46 |
- * critically important for making portable several classes of |
47 |
- * applications including cryptography, hashing, variable length |
48 |
- * integer libraries and so on. But for most developers its likely |
49 |
- * useful just for programming sanity. |
50 |
- * |
28 |
- * The problem is that most compiler vendors have decided not to |
51 |
- * The problem is that most compiler vendors have decided not to |
29 |
- * implement the C99 standard, and the next C++ language standard |
52 |
- * implement the C99 standard, and the next C++ language standard |
30 |
- * (which has a lot more mindshare these days) will be a long time in |
53 |
- * (which has a lot more mindshare these days) will be a long time in |
Lines 33-68
Link Here
|
33 |
- * before all compilers come with a stdint.h and it also does nothing |
56 |
- * before all compilers come with a stdint.h and it also does nothing |
34 |
- * for the extremely large number of compilers available today which |
57 |
- * for the extremely large number of compilers available today which |
35 |
- * do not include this file, or anything comparable to it. |
58 |
- * do not include this file, or anything comparable to it. |
|
|
59 |
- * |
60 |
- * So that's what this file is all about. Its an attempt to build a |
61 |
- * single universal include file that works on as many platforms as |
62 |
- * possible to deliver what stdint.h is supposed to. A few things |
63 |
- * that should be noted about this file: |
64 |
- * |
65 |
- * 1) It is not guaranteed to be portable and/or present an identical |
66 |
- * interface on all platforms. The extreme variability of the |
67 |
- * ANSI C standard makes this an impossibility right from the |
68 |
- * very get go. Its really only meant to be useful for the vast |
69 |
- * majority of platforms that possess the capability of |
70 |
- * implementing usefully and precisely defined, standard sized |
71 |
- * integer scalars. Systems which are not intrinsically 2s |
72 |
- * complement may produce invalid constants. |
73 |
- * |
74 |
- * 2) There is an unavoidable use of non-reserved symbols. |
75 |
- * |
76 |
- * 3) Other standard include files are invoked. |
77 |
- * |
78 |
- * 4) This file may come in conflict with future platforms that do |
79 |
- * include stdint.h. The hope is that one or the other can be |
80 |
- * used with no real difference. |
81 |
- * |
82 |
- * 5) In the current version, if your platform can't represent |
83 |
- * int32_t, int16_t and int8_t, it just dumps out with a compiler |
84 |
- * error. |
85 |
- * |
86 |
- * 6) 64 bit integers may or may not be defined. Test for their |
87 |
- * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. |
88 |
- * Note that this is different from the C99 specification which |
89 |
- * requires the existence of 64 bit support in the compiler. If |
90 |
- * this is not defined for your platform, yet it is capable of |
91 |
- * dealing with 64 bits then it is because this file has not yet |
92 |
- * been extended to cover all of your system's capabilities. |
93 |
- * |
94 |
- * 7) (u)intptr_t may or may not be defined. Test for its presence |
95 |
- * with the test: #ifdef PTRDIFF_MAX. If this is not defined |
96 |
- * for your platform, then it is because this file has not yet |
97 |
- * been extended to cover all of your system's capabilities, not |
98 |
- * because its optional. |
99 |
- * |
100 |
- * 8) The following might not been defined even if your platform is |
101 |
- * capable of defining it: |
102 |
- * |
103 |
- * WCHAR_MIN |
104 |
- * WCHAR_MAX |
105 |
- * (u)int64_t |
106 |
- * PTRDIFF_MIN |
107 |
- * PTRDIFF_MAX |
108 |
- * (u)intptr_t |
109 |
- * |
110 |
- * 9) The following have not been defined: |
111 |
- * |
112 |
- * WINT_MIN |
113 |
- * WINT_MAX |
114 |
- * |
115 |
- * 10) The criteria for defining (u)int_least(*)_t isn't clear, |
116 |
- * except for systems which don't have a type that precisely |
117 |
- * defined 8, 16, or 32 bit types (which this include file does |
118 |
- * not support anyways). Default definitions have been given. |
119 |
- * |
120 |
- * 11) The criteria for defining (u)int_fast(*)_t isn't something I |
121 |
- * would trust to any particular compiler vendor or the ANSI C |
122 |
- * committee. It is well known that "compatible systems" are |
123 |
- * commonly created that have very different performance |
124 |
- * characteristics from the systems they are compatible with, |
125 |
- * especially those whose vendors make both the compiler and the |
126 |
- * system. Default definitions have been given, but its strongly |
127 |
- * recommended that users never use these definitions for any |
128 |
- * reason (they do *NOT* deliver any serious guarantee of |
129 |
- * improved performance -- not in this file, nor any vendor's |
130 |
- * stdint.h). |
131 |
- * |
132 |
- * 12) The following macros: |
133 |
- * |
134 |
- * PRINTF_INTMAX_MODIFIER |
135 |
- * PRINTF_INT64_MODIFIER |
136 |
- * PRINTF_INT32_MODIFIER |
137 |
- * PRINTF_INT16_MODIFIER |
138 |
- * PRINTF_LEAST64_MODIFIER |
139 |
- * PRINTF_LEAST32_MODIFIER |
140 |
- * PRINTF_LEAST16_MODIFIER |
141 |
- * PRINTF_INTPTR_MODIFIER |
142 |
- * |
143 |
- * are strings which have been defined as the modifiers required |
144 |
- * for the "d", "u" and "x" printf formats to correctly output |
145 |
- * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, |
146 |
- * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. |
147 |
- * PRINTF_INTPTR_MODIFIER is not defined for some systems which |
148 |
- * provide their own stdint.h. PRINTF_INT64_MODIFIER is not |
149 |
- * defined if INT64_MAX is not defined. These are an extension |
150 |
- * beyond what C99 specifies must be in stdint.h. |
151 |
- * |
152 |
- * In addition, the following macros are defined: |
153 |
- * |
154 |
- * PRINTF_INTMAX_HEX_WIDTH |
155 |
- * PRINTF_INT64_HEX_WIDTH |
156 |
- * PRINTF_INT32_HEX_WIDTH |
157 |
- * PRINTF_INT16_HEX_WIDTH |
158 |
- * PRINTF_INT8_HEX_WIDTH |
159 |
- * PRINTF_INTMAX_DEC_WIDTH |
160 |
- * PRINTF_INT64_DEC_WIDTH |
161 |
- * PRINTF_INT32_DEC_WIDTH |
162 |
- * PRINTF_INT16_DEC_WIDTH |
163 |
- * PRINTF_INT8_DEC_WIDTH |
164 |
- * |
165 |
- * Which specifies the maximum number of characters required to |
166 |
- * print the number of that type in either hexadecimal or decimal. |
167 |
- * These are an extension beyond what C99 specifies must be in |
168 |
- * stdint.h. |
169 |
- * |
170 |
- * Compilers tested (all with 0 warnings at their highest respective |
171 |
- * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 |
172 |
- * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio |
173 |
- * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 |
174 |
- * |
175 |
- * This file should be considered a work in progress. Suggestions for |
176 |
- * improvements, especially those which increase coverage are strongly |
177 |
- * encouraged. |
178 |
- * |
179 |
- * Acknowledgements |
180 |
- * |
181 |
- * Edited by Philip G. Lee <rocketman768@gmail.com> 2011 to avoid overlap with sys/types.h |
182 |
- * |
183 |
- * The following people have made significant contributions to the |
184 |
- * development and testing of this file: |
185 |
- * |
186 |
- * Chris Howie |
187 |
- * John Steele Scott |
188 |
- * Dave Thorup |
189 |
- * John Dill |
190 |
- * |
191 |
- */ |
192 |
- |
193 |
-#include <stddef.h> |
194 |
-#include <limits.h> |
195 |
-#include <signal.h> |
196 |
- |
197 |
-/* |
198 |
- * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and |
199 |
- * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. |
200 |
- */ |
201 |
- |
202 |
-#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) |
203 |
-#include <stdint.h> |
204 |
-#define _PSTDINT_H_INCLUDED |
205 |
-# ifndef PRINTF_INT64_MODIFIER |
206 |
-# define PRINTF_INT64_MODIFIER "ll" |
207 |
-# endif |
208 |
-# ifndef PRINTF_INT32_MODIFIER |
209 |
-# define PRINTF_INT32_MODIFIER "l" |
210 |
-# endif |
211 |
-# ifndef PRINTF_INT16_MODIFIER |
212 |
-# define PRINTF_INT16_MODIFIER "h" |
213 |
-# endif |
214 |
-# ifndef PRINTF_INTMAX_MODIFIER |
215 |
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER |
216 |
-# endif |
217 |
-# ifndef PRINTF_INT64_HEX_WIDTH |
218 |
-# define PRINTF_INT64_HEX_WIDTH "16" |
219 |
-# endif |
220 |
-# ifndef PRINTF_INT32_HEX_WIDTH |
221 |
-# define PRINTF_INT32_HEX_WIDTH "8" |
222 |
-# endif |
223 |
-# ifndef PRINTF_INT16_HEX_WIDTH |
224 |
-# define PRINTF_INT16_HEX_WIDTH "4" |
225 |
-# endif |
226 |
-# ifndef PRINTF_INT8_HEX_WIDTH |
227 |
-# define PRINTF_INT8_HEX_WIDTH "2" |
228 |
-# endif |
229 |
-# ifndef PRINTF_INT64_DEC_WIDTH |
230 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
231 |
-# endif |
232 |
-# ifndef PRINTF_INT32_DEC_WIDTH |
233 |
-# define PRINTF_INT32_DEC_WIDTH "10" |
234 |
-# endif |
235 |
-# ifndef PRINTF_INT16_DEC_WIDTH |
236 |
-# define PRINTF_INT16_DEC_WIDTH "5" |
237 |
-# endif |
238 |
-# ifndef PRINTF_INT8_DEC_WIDTH |
239 |
-# define PRINTF_INT8_DEC_WIDTH "3" |
240 |
-# endif |
241 |
-# ifndef PRINTF_INTMAX_HEX_WIDTH |
242 |
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH |
243 |
-# endif |
244 |
-# ifndef PRINTF_INTMAX_DEC_WIDTH |
245 |
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH |
246 |
-# endif |
247 |
- |
248 |
-/* |
249 |
- * Something really weird is going on with Open Watcom. Just pull some of |
250 |
- * these duplicated definitions from Open Watcom's stdint.h file for now. |
251 |
- */ |
252 |
- |
253 |
-# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 |
254 |
-# if !defined (INT64_C) |
255 |
-# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) |
256 |
-# endif |
257 |
-# if !defined (UINT64_C) |
258 |
-# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) |
259 |
-# endif |
260 |
-# if !defined (INT32_C) |
261 |
-# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) |
262 |
-# endif |
263 |
-# if !defined (UINT32_C) |
264 |
-# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) |
265 |
-# endif |
266 |
-# if !defined (INT16_C) |
267 |
-# define INT16_C(x) (x) |
268 |
-# endif |
269 |
-# if !defined (UINT16_C) |
270 |
-# define UINT16_C(x) (x) |
271 |
-# endif |
272 |
-# if !defined (INT8_C) |
273 |
-# define INT8_C(x) (x) |
274 |
-# endif |
275 |
-# if !defined (UINT8_C) |
276 |
-# define UINT8_C(x) (x) |
277 |
-# endif |
278 |
-# if !defined (UINT64_MAX) |
279 |
-# define UINT64_MAX 18446744073709551615ULL |
280 |
-# endif |
281 |
-# if !defined (INT64_MAX) |
282 |
-# define INT64_MAX 9223372036854775807LL |
283 |
-# endif |
284 |
-# if !defined (UINT32_MAX) |
285 |
-# define UINT32_MAX 4294967295UL |
286 |
-# endif |
287 |
-# if !defined (INT32_MAX) |
288 |
-# define INT32_MAX 2147483647L |
289 |
-# endif |
290 |
-# if !defined (INTMAX_MAX) |
291 |
-# define INTMAX_MAX INT64_MAX |
292 |
-# endif |
293 |
-# if !defined (INTMAX_MIN) |
294 |
-# define INTMAX_MIN INT64_MIN |
295 |
-# endif |
296 |
-# endif |
297 |
-#endif |
298 |
- |
299 |
-#ifndef _PSTDINT_H_INCLUDED |
300 |
-#define _PSTDINT_H_INCLUDED |
301 |
- |
302 |
-#ifndef SIZE_MAX |
303 |
-# define SIZE_MAX (~(size_t)0) |
304 |
-#endif |
305 |
- |
306 |
-/* |
307 |
- * Deduce the type assignments from limits.h under the assumption that |
308 |
- * integer sizes in bits are powers of 2, and follow the ANSI |
309 |
- * definitions. |
310 |
- */ |
311 |
- |
312 |
- |
313 |
-// Avoid overlap with sys/types.h |
314 |
-#ifndef __int8_t_defined |
315 |
-#define __int8_t_defined |
316 |
- |
317 |
-#ifndef INT8_MAX |
318 |
-# define INT8_MAX 0x7f |
319 |
-#endif |
320 |
-#ifndef INT8_MIN |
321 |
-# define INT8_MIN INT8_C(0x80) |
322 |
-#endif |
323 |
-#ifndef int8_t |
324 |
-# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) |
325 |
-typedef signed char int8_t; |
326 |
-# define INT8_C(v) ((int8_t) v) |
327 |
-# else |
328 |
-# error "Platform not supported" |
329 |
-# endif |
330 |
-#endif |
331 |
- |
332 |
-#ifndef INT16_MAX |
333 |
-# define INT16_MAX 0x7fff |
334 |
-#endif |
335 |
-#ifndef INT16_MIN |
336 |
-# define INT16_MIN INT16_C(0x8000) |
337 |
-#endif |
338 |
-#ifndef int16_t |
339 |
-#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) |
340 |
-typedef signed int int16_t; |
341 |
-# define INT16_C(v) ((int16_t) (v)) |
342 |
-# ifndef PRINTF_INT16_MODIFIER |
343 |
-# define PRINTF_INT16_MODIFIER "" |
344 |
-# endif |
345 |
-#elif (SHRT_MAX == INT16_MAX) |
346 |
-typedef signed short int16_t; |
347 |
-# define INT16_C(v) ((int16_t) (v)) |
348 |
-# ifndef PRINTF_INT16_MODIFIER |
349 |
-# define PRINTF_INT16_MODIFIER "h" |
350 |
-# endif |
351 |
-#else |
352 |
-#error "Platform not supported" |
353 |
-#endif |
354 |
-#endif |
355 |
- |
356 |
-#ifndef INT32_MAX |
357 |
-# define INT32_MAX (0x7fffffffL) |
358 |
-#endif |
359 |
-#ifndef INT32_MIN |
360 |
-# define INT32_MIN INT32_C(0x80000000) |
361 |
-#endif |
362 |
-#ifndef int32_t |
363 |
-#if ((LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)) && ! defined(__FreeBSD__) |
364 |
-typedef signed long int32_t; |
365 |
-# define INT32_C(v) v ## L |
366 |
-# ifndef PRINTF_INT32_MODIFIER |
367 |
-# define PRINTF_INT32_MODIFIER "l" |
368 |
-# endif |
369 |
-#elif (INT_MAX == INT32_MAX) |
370 |
-typedef signed int int32_t; |
371 |
-# define INT32_C(v) v |
372 |
-# ifndef PRINTF_INT32_MODIFIER |
373 |
-# define PRINTF_INT32_MODIFIER "" |
374 |
-# endif |
375 |
-#elif (SHRT_MAX == INT32_MAX) |
376 |
-typedef signed short int32_t; |
377 |
-# define INT32_C(v) ((short) (v)) |
378 |
-# ifndef PRINTF_INT32_MODIFIER |
379 |
-# define PRINTF_INT32_MODIFIER "" |
380 |
-# endif |
381 |
-#else |
382 |
-#error "Platform not supported" |
383 |
-#endif |
384 |
-#endif |
385 |
- |
386 |
-// 64-bit shit seems more tricky. Philip Lee <rocketman768@gmail.com> |
387 |
-/* |
388 |
-* The macro stdint_int64_defined is temporarily used to record |
389 |
-* whether or not 64 integer support is available. It must be |
390 |
-* defined for any 64 integer extensions for new platforms that are |
391 |
-* added. |
392 |
-*/ |
393 |
-#undef stdint_int64_defined |
394 |
-#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) |
395 |
-# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) |
396 |
-# define stdint_int64_defined |
397 |
-typedef long long int64_t; |
398 |
-# endif |
399 |
-#endif |
400 |
-#if !defined (stdint_int64_defined) |
401 |
-# if defined(__GNUC__) |
402 |
-# define stdint_int64_defined |
403 |
-# ifndef __FreeBSD__ |
404 |
- __extension__ typedef long long int64_t; |
405 |
-# endif |
406 |
-# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) |
407 |
-# define stdint_int64_defined |
408 |
-typedef long long int64_t; |
409 |
-# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) |
410 |
-# define stdint_int64_defined |
411 |
-typedef __int64 int64_t; |
412 |
-# endif |
413 |
-#endif |
414 |
- |
415 |
-#endif /*ifndef __int8_t_defined*/ |
416 |
- |
417 |
-#ifndef UINT8_MAX |
418 |
-# define UINT8_MAX 0xff |
419 |
-#endif |
420 |
-#ifndef uint8_t |
421 |
-# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) |
422 |
- typedef unsigned char uint8_t; |
423 |
-# define UINT8_C(v) ((uint8_t) v) |
424 |
-# else |
425 |
-# error "Platform not supported" |
426 |
-# endif |
427 |
-#endif |
428 |
- |
429 |
-#ifndef UINT16_MAX |
430 |
-# define UINT16_MAX 0xffff |
431 |
-#endif |
432 |
-#ifndef uint16_t |
433 |
-#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) |
434 |
- typedef unsigned int uint16_t; |
435 |
-# ifndef PRINTF_INT16_MODIFIER |
436 |
-# define PRINTF_INT16_MODIFIER "" |
437 |
-# endif |
438 |
-# define UINT16_C(v) ((uint16_t) (v)) |
439 |
-#elif (USHRT_MAX == UINT16_MAX) |
440 |
- typedef unsigned short uint16_t; |
441 |
-# define UINT16_C(v) ((uint16_t) (v)) |
442 |
-# ifndef PRINTF_INT16_MODIFIER |
443 |
-# define PRINTF_INT16_MODIFIER "h" |
444 |
-# endif |
445 |
-#else |
446 |
-#error "Platform not supported" |
447 |
-#endif |
448 |
-#endif |
449 |
- |
450 |
-#ifndef UINT32_MAX |
451 |
-# define UINT32_MAX (0xffffffffUL) |
452 |
-#endif |
453 |
-#ifndef uint32_t |
454 |
-#if ((ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)) && ! defined(__FreeBSD__) |
455 |
- typedef unsigned long uint32_t; |
456 |
-# define UINT32_C(v) v ## UL |
457 |
-# ifndef PRINTF_INT32_MODIFIER |
458 |
-# define PRINTF_INT32_MODIFIER "l" |
459 |
-# endif |
460 |
-#elif (UINT_MAX == UINT32_MAX) |
461 |
- typedef unsigned int uint32_t; |
462 |
-# ifndef PRINTF_INT32_MODIFIER |
463 |
-# define PRINTF_INT32_MODIFIER "" |
464 |
-# endif |
465 |
-# define UINT32_C(v) v ## U |
466 |
-#elif (USHRT_MAX == UINT32_MAX) |
467 |
- typedef unsigned short uint32_t; |
468 |
-# define UINT32_C(v) ((unsigned short) (v)) |
469 |
-# ifndef PRINTF_INT32_MODIFIER |
470 |
-# define PRINTF_INT32_MODIFIER "" |
471 |
-# endif |
472 |
-#else |
473 |
-#error "Platform not supported" |
474 |
-#endif |
475 |
-#endif |
476 |
- |
477 |
-/* |
478 |
- * The macro stdint_int64_defined is temporarily used to record |
479 |
- * whether or not 64 integer support is available. It must be |
480 |
- * defined for any 64 integer extensions for new platforms that are |
481 |
- * added. |
482 |
- */ |
483 |
- |
484 |
-#undef stdint_int64_defined |
485 |
-#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) |
486 |
-# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) |
487 |
-# define stdint_int64_defined |
488 |
-# ifndef __FreeBSD__ |
489 |
- typedef unsigned long long uint64_t; |
490 |
-# endif |
491 |
-# define UINT64_C(v) v ## ULL |
492 |
-# define INT64_C(v) v ## LL |
493 |
-# ifndef PRINTF_INT64_MODIFIER |
494 |
-# define PRINTF_INT64_MODIFIER "ll" |
495 |
-# endif |
496 |
-# endif |
497 |
-#endif |
498 |
- |
499 |
-#if !defined (stdint_int64_defined) |
500 |
-# if defined(__GNUC__) |
501 |
-# define stdint_int64_defined |
502 |
-# ifndef __FreeBSD__ |
503 |
- __extension__ typedef unsigned long long uint64_t; |
504 |
-# endif |
505 |
-# define UINT64_C(v) v ## ULL |
506 |
-# define INT64_C(v) v ## LL |
507 |
-# ifndef PRINTF_INT64_MODIFIER |
508 |
-# define PRINTF_INT64_MODIFIER "ll" |
509 |
-# endif |
510 |
-# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) |
511 |
-# define stdint_int64_defined |
512 |
- typedef unsigned long long uint64_t; |
513 |
-# define UINT64_C(v) v ## ULL |
514 |
-# define INT64_C(v) v ## LL |
515 |
-# ifndef PRINTF_INT64_MODIFIER |
516 |
-# define PRINTF_INT64_MODIFIER "ll" |
517 |
-# endif |
518 |
-# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) |
519 |
-# define stdint_int64_defined |
520 |
- typedef unsigned __int64 uint64_t; |
521 |
-# define UINT64_C(v) v ## UI64 |
522 |
-# define INT64_C(v) v ## I64 |
523 |
-# ifndef PRINTF_INT64_MODIFIER |
524 |
-# define PRINTF_INT64_MODIFIER "I64" |
525 |
-# endif |
526 |
-# endif |
527 |
-#endif |
528 |
- |
529 |
-#if !defined (LONG_LONG_MAX) && defined (INT64_C) |
530 |
-# define LONG_LONG_MAX INT64_C (9223372036854775807) |
531 |
-#endif |
532 |
-#ifndef ULONG_LONG_MAX |
533 |
-# define ULONG_LONG_MAX UINT64_C (18446744073709551615) |
534 |
-#endif |
535 |
- |
536 |
-#if !defined (INT64_MAX) && defined (INT64_C) |
537 |
-# define INT64_MAX INT64_C (9223372036854775807) |
538 |
-#endif |
539 |
-#if !defined (INT64_MIN) && defined (INT64_C) |
540 |
-# define INT64_MIN INT64_C (-9223372036854775808) |
541 |
-#endif |
542 |
-#if !defined (UINT64_MAX) && defined (INT64_C) |
543 |
-# define UINT64_MAX UINT64_C (18446744073709551615) |
544 |
-#endif |
545 |
- |
546 |
-/* |
547 |
- * Width of hexadecimal for number field. |
548 |
- */ |
549 |
- |
550 |
-#ifndef PRINTF_INT64_HEX_WIDTH |
551 |
-# define PRINTF_INT64_HEX_WIDTH "16" |
552 |
-#endif |
553 |
-#ifndef PRINTF_INT32_HEX_WIDTH |
554 |
-# define PRINTF_INT32_HEX_WIDTH "8" |
555 |
-#endif |
556 |
-#ifndef PRINTF_INT16_HEX_WIDTH |
557 |
-# define PRINTF_INT16_HEX_WIDTH "4" |
558 |
-#endif |
559 |
-#ifndef PRINTF_INT8_HEX_WIDTH |
560 |
-# define PRINTF_INT8_HEX_WIDTH "2" |
561 |
-#endif |
562 |
- |
563 |
-#ifndef PRINTF_INT64_DEC_WIDTH |
564 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
565 |
-#endif |
566 |
-#ifndef PRINTF_INT32_DEC_WIDTH |
567 |
-# define PRINTF_INT32_DEC_WIDTH "10" |
568 |
-#endif |
569 |
-#ifndef PRINTF_INT16_DEC_WIDTH |
570 |
-# define PRINTF_INT16_DEC_WIDTH "5" |
571 |
-#endif |
572 |
-#ifndef PRINTF_INT8_DEC_WIDTH |
573 |
-# define PRINTF_INT8_DEC_WIDTH "3" |
574 |
-#endif |
575 |
- |
576 |
-/* |
577 |
- * Ok, lets not worry about 128 bit integers for now. Moore's law says |
578 |
- * we don't need to worry about that until about 2040 at which point |
579 |
- * we'll have bigger things to worry about. |
580 |
- */ |
581 |
- |
582 |
-#ifdef stdint_int64_defined |
583 |
- typedef int64_t intmax_t; |
584 |
- typedef uint64_t uintmax_t; |
585 |
-# define INTMAX_MAX INT64_MAX |
586 |
-# define INTMAX_MIN INT64_MIN |
587 |
-# define UINTMAX_MAX UINT64_MAX |
588 |
-# define UINTMAX_C(v) UINT64_C(v) |
589 |
-# define INTMAX_C(v) INT64_C(v) |
590 |
-# ifndef PRINTF_INTMAX_MODIFIER |
591 |
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER |
592 |
-# endif |
593 |
-# ifndef PRINTF_INTMAX_HEX_WIDTH |
594 |
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH |
595 |
-# endif |
596 |
-# ifndef PRINTF_INTMAX_DEC_WIDTH |
597 |
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH |
598 |
-# endif |
599 |
-#else |
600 |
- typedef int32_t intmax_t; |
601 |
- typedef uint32_t uintmax_t; |
602 |
-# define INTMAX_MAX INT32_MAX |
603 |
-# define UINTMAX_MAX UINT32_MAX |
604 |
-# define UINTMAX_C(v) UINT32_C(v) |
605 |
-# define INTMAX_C(v) INT32_C(v) |
606 |
-# ifndef PRINTF_INTMAX_MODIFIER |
607 |
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER |
608 |
-# endif |
609 |
-# ifndef PRINTF_INTMAX_HEX_WIDTH |
610 |
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH |
611 |
-# endif |
612 |
-# ifndef PRINTF_INTMAX_DEC_WIDTH |
613 |
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH |
614 |
-# endif |
615 |
-#endif |
616 |
- |
617 |
-/* |
618 |
- * Because this file currently only supports platforms which have |
619 |
- * precise powers of 2 as bit sizes for the default integers, the |
620 |
- * least definitions are all trivial. Its possible that a future |
621 |
- * version of this file could have different definitions. |
622 |
- */ |
623 |
- |
624 |
-#ifndef stdint_least_defined |
625 |
- typedef int8_t int_least8_t; |
626 |
- typedef uint8_t uint_least8_t; |
627 |
- typedef int16_t int_least16_t; |
628 |
- typedef uint16_t uint_least16_t; |
629 |
- typedef int32_t int_least32_t; |
630 |
- typedef uint32_t uint_least32_t; |
631 |
-# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER |
632 |
-# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER |
633 |
-# define UINT_LEAST8_MAX UINT8_MAX |
634 |
-# define INT_LEAST8_MAX INT8_MAX |
635 |
-# define UINT_LEAST16_MAX UINT16_MAX |
636 |
-# define INT_LEAST16_MAX INT16_MAX |
637 |
-# define UINT_LEAST32_MAX UINT32_MAX |
638 |
-# define INT_LEAST32_MAX INT32_MAX |
639 |
-# define INT_LEAST8_MIN INT8_MIN |
640 |
-# define INT_LEAST16_MIN INT16_MIN |
641 |
-# define INT_LEAST32_MIN INT32_MIN |
642 |
-# ifdef stdint_int64_defined |
643 |
- typedef int64_t int_least64_t; |
644 |
- typedef uint64_t uint_least64_t; |
645 |
-# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER |
646 |
-# define UINT_LEAST64_MAX UINT64_MAX |
647 |
-# define INT_LEAST64_MAX INT64_MAX |
648 |
-# define INT_LEAST64_MIN INT64_MIN |
649 |
-# endif |
650 |
-#endif |
651 |
-#undef stdint_least_defined |
652 |
- |
653 |
-/* |
654 |
- * The ANSI C committee pretending to know or specify anything about |
655 |
- * performance is the epitome of misguided arrogance. The mandate of |
656 |
- * this file is to *ONLY* ever support that absolute minimum |
657 |
- * definition of the fast integer types, for compatibility purposes. |
658 |
- * No extensions, and no attempt to suggest what may or may not be a |
659 |
- * faster integer type will ever be made in this file. Developers are |
660 |
- * warned to stay away from these types when using this or any other |
661 |
- * stdint.h. |
662 |
- */ |
663 |
- |
664 |
-#ifndef __FreeBSD__ |
665 |
-typedef int_least8_t int_fast8_t; |
666 |
-typedef uint_least8_t uint_fast8_t; |
667 |
-typedef int_least16_t int_fast16_t; |
668 |
-typedef uint_least16_t uint_fast16_t; |
669 |
-#endif |
670 |
-typedef int_least32_t int_fast32_t; |
671 |
-typedef uint_least32_t uint_fast32_t; |
672 |
-#define UINT_FAST8_MAX UINT_LEAST8_MAX |
673 |
-#define INT_FAST8_MAX INT_LEAST8_MAX |
674 |
-#define UINT_FAST16_MAX UINT_LEAST16_MAX |
675 |
-#define INT_FAST16_MAX INT_LEAST16_MAX |
676 |
-#define UINT_FAST32_MAX UINT_LEAST32_MAX |
677 |
-#define INT_FAST32_MAX INT_LEAST32_MAX |
678 |
-#define INT_FAST8_MIN INT_LEAST8_MIN |
679 |
-#define INT_FAST16_MIN INT_LEAST16_MIN |
680 |
-#define INT_FAST32_MIN INT_LEAST32_MIN |
681 |
-#ifdef stdint_int64_defined |
682 |
- typedef int_least64_t int_fast64_t; |
683 |
- typedef uint_least64_t uint_fast64_t; |
684 |
-# define UINT_FAST64_MAX UINT_LEAST64_MAX |
685 |
-# define INT_FAST64_MAX INT_LEAST64_MAX |
686 |
-# define INT_FAST64_MIN INT_LEAST64_MIN |
687 |
-#endif |
688 |
- |
689 |
-#undef stdint_int64_defined |
690 |
- |
691 |
-/* |
692 |
- * Whatever piecemeal, per compiler thing we can do about the wchar_t |
693 |
- * type limits. |
694 |
- */ |
695 |
- |
696 |
-#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) |
697 |
-# include <wchar.h> |
698 |
-# ifndef WCHAR_MIN |
699 |
-# define WCHAR_MIN 0 |
700 |
-# endif |
701 |
-# ifndef WCHAR_MAX |
702 |
-# define WCHAR_MAX ((wchar_t)-1) |
703 |
-# endif |
704 |
-#endif |
705 |
- |
706 |
-/* |
707 |
- * Whatever piecemeal, per compiler/platform thing we can do about the |
708 |
- * (u)intptr_t types and limits. |
709 |
- */ |
710 |
- |
711 |
-#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) |
712 |
-# define STDINT_H_UINTPTR_T_DEFINED |
713 |
-#endif |
714 |
- |
715 |
-#ifndef STDINT_H_UINTPTR_T_DEFINED |
716 |
-# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) |
717 |
-# define stdint_intptr_bits 64 |
718 |
-# elif defined (__WATCOMC__) || defined (__TURBOC__) |
719 |
-# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) |
720 |
-# define stdint_intptr_bits 16 |
721 |
-# else |
722 |
-# define stdint_intptr_bits 32 |
723 |
-# endif |
724 |
-# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) |
725 |
-# define stdint_intptr_bits 32 |
726 |
-# elif defined (__INTEL_COMPILER) |
727 |
-/* TODO -- what did Intel do about x86-64? */ |
728 |
-# endif |
729 |
- |
730 |
-# ifdef stdint_intptr_bits |
731 |
-# define stdint_intptr_glue3_i(a,b,c) a##b##c |
732 |
-# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) |
733 |
-# ifndef PRINTF_INTPTR_MODIFIER |
734 |
-# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) |
735 |
-# endif |
736 |
-# ifndef PTRDIFF_MAX |
737 |
-# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) |
738 |
-# endif |
739 |
-# ifndef PTRDIFF_MIN |
740 |
-# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) |
741 |
-# endif |
742 |
-# ifndef UINTPTR_MAX |
743 |
-# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) |
744 |
-# endif |
745 |
-# ifndef INTPTR_MAX |
746 |
-# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) |
747 |
-# endif |
748 |
-# ifndef INTPTR_MIN |
749 |
-# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) |
750 |
-# endif |
751 |
-# ifndef INTPTR_C |
752 |
-# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) |
753 |
-# endif |
754 |
-# ifndef UINTPTR_C |
755 |
-# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) |
756 |
-# endif |
757 |
-// Philip <rocketman768@gmail.com>, need to check if [u]intprt_t is already defined... |
758 |
-# ifndef __uintptr_t_defined |
759 |
-# define __uintptr_t_defined |
760 |
- typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; |
761 |
-# endif /*uintptr_t*/ |
762 |
-# ifndef __intptr_t_defined |
763 |
-# define __intptr_t_defined |
764 |
- typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; |
765 |
-# endif /*__intptr_t_defined*/ |
766 |
-# else |
767 |
-/* TODO -- This following is likely wrong for some platforms, and does |
768 |
- nothing for the definition of uintptr_t. */ |
769 |
- typedef ptrdiff_t intptr_t; |
770 |
-# endif |
771 |
-# define STDINT_H_UINTPTR_T_DEFINED |
772 |
-#endif |
773 |
- |
774 |
-/* |
775 |
- * Assumes sig_atomic_t is signed and we have a 2s complement machine. |
776 |
- */ |
777 |
- |
778 |
-#ifndef SIG_ATOMIC_MAX |
779 |
-# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) |
780 |
-#endif |
781 |
- |
782 |
-#endif |
783 |
- |
784 |
-#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) |
785 |
- |
786 |
-/* |
787 |
- * Please compile with the maximum warning settings to make sure macros are not |
788 |
- * defined more than once. |
789 |
- */ |
790 |
- |
791 |
-#include <stdlib.h> |
792 |
-#include <stdio.h> |
793 |
-#include <string.h> |
794 |
- |
795 |
-#define glue3_aux(x,y,z) x ## y ## z |
796 |
-#define glue3(x,y,z) glue3_aux(x,y,z) |
797 |
- |
798 |
-#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0); |
799 |
-#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0); |
800 |
- |
801 |
-#define DECL(us,bits) glue3(DECL,us,) (bits) |
802 |
- |
803 |
-#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits) |
804 |
- |
805 |
-int main () { |
806 |
- DECL(I,8) |
807 |
- DECL(U,8) |
808 |
- DECL(I,16) |
809 |
- DECL(U,16) |
810 |
- DECL(I,32) |
811 |
- DECL(U,32) |
812 |
-#ifdef INT64_MAX |
813 |
- DECL(I,64) |
814 |
- DECL(U,64) |
815 |
-#endif |
816 |
- intmax_t imax = INTMAX_C(0); |
817 |
- uintmax_t umax = UINTMAX_C(0); |
818 |
- char str0[256], str1[256]; |
819 |
- |
820 |
- sprintf (str0, "%d %x\n", 0, ~0); |
821 |
- |
822 |
- sprintf (str1, "%d %x\n", i8, ~0); |
823 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1); |
824 |
- sprintf (str1, "%u %x\n", u8, ~0); |
825 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1); |
826 |
- sprintf (str1, "%d %x\n", i16, ~0); |
827 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1); |
828 |
- sprintf (str1, "%u %x\n", u16, ~0); |
829 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1); |
830 |
- sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); |
831 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1); |
832 |
- sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); |
833 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1); |
834 |
-#ifdef INT64_MAX |
835 |
- sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); |
836 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1); |
837 |
-#endif |
838 |
- sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); |
839 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1); |
840 |
- sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); |
841 |
- if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1); |
842 |
- |
843 |
- TESTUMAX(8); |
844 |
- TESTUMAX(16); |
845 |
- TESTUMAX(32); |
846 |
-#ifdef INT64_MAX |
847 |
- TESTUMAX(64); |
848 |
-#endif |
849 |
- |
850 |
- return EXIT_SUCCESS; |
851 |
-} |
852 |
- |
853 |
-#endif |
854 |
+/* A portable stdint.h |
855 |
+ **************************************************************************** |
856 |
+ * BSD License: |
857 |
+ **************************************************************************** |
858 |
+ * |
859 |
+ * Copyright (c) 2005-2016 Paul Hsieh |
860 |
+ * All rights reserved. |
861 |
+ * |
862 |
+ * Redistribution and use in source and binary forms, with or without |
863 |
+ * modification, are permitted provided that the following conditions |
864 |
+ * are met: |
865 |
+ * |
866 |
+ * 1. Redistributions of source code must retain the above copyright |
867 |
+ * notice, this list of conditions and the following disclaimer. |
868 |
+ * 2. Redistributions in binary form must reproduce the above copyright |
869 |
+ * notice, this list of conditions and the following disclaimer in the |
870 |
+ * documentation and/or other materials provided with the distribution. |
871 |
+ * 3. The name of the author may not be used to endorse or promote products |
872 |
+ * derived from this software without specific prior written permission. |
873 |
+ * |
874 |
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
875 |
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
876 |
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
877 |
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
878 |
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
879 |
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
880 |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
881 |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
882 |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
883 |
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
884 |
+ * |
885 |
+ **************************************************************************** |
886 |
+ * |
887 |
+ * Version 0.1.15.4 |
888 |
+ * |
889 |
+ * The ANSI C standard committee, for the C99 standard, specified the |
890 |
+ * inclusion of a new standard include file called stdint.h. This is |
891 |
+ * a very useful and long desired include file which contains several |
892 |
+ * very precise definitions for integer scalar types that is |
893 |
+ * critically important for making portable several classes of |
894 |
+ * applications including cryptography, hashing, variable length |
895 |
+ * integer libraries and so on. But for most developers its likely |
896 |
+ * useful just for programming sanity. |
897 |
+ * |
36 |
+ * The problem is that some compiler vendors chose to ignore the C99 |
898 |
+ * The problem is that some compiler vendors chose to ignore the C99 |
37 |
+ * standard and some older compilers have no opportunity to be updated. |
899 |
+ * standard and some older compilers have no opportunity to be updated. |
38 |
+ * Because of this situation, simply including stdint.h in your code |
900 |
+ * Because of this situation, simply including stdint.h in your code |
39 |
+ * makes it unportable. |
901 |
+ * makes it unportable. |
40 |
* |
902 |
+ * |
41 |
* So that's what this file is all about. Its an attempt to build a |
903 |
+ * So that's what this file is all about. Its an attempt to build a |
42 |
* single universal include file that works on as many platforms as |
904 |
+ * single universal include file that works on as many platforms as |
43 |
- * possible to deliver what stdint.h is supposed to. A few things |
|
|
44 |
- * that should be noted about this file: |
45 |
+ * possible to deliver what stdint.h is supposed to. Even compilers |
905 |
+ * possible to deliver what stdint.h is supposed to. Even compilers |
46 |
+ * that already come with stdint.h can use this file instead without |
906 |
+ * that already come with stdint.h can use this file instead without |
47 |
+ * any loss of functionality. A few things that should be noted about |
907 |
+ * any loss of functionality. A few things that should be noted about |
48 |
+ * this file: |
908 |
+ * this file: |
49 |
* |
909 |
+ * |
50 |
* 1) It is not guaranteed to be portable and/or present an identical |
910 |
+ * 1) It is not guaranteed to be portable and/or present an identical |
51 |
* interface on all platforms. The extreme variability of the |
911 |
+ * interface on all platforms. The extreme variability of the |
52 |
@@ -73,7 +71,7 @@ |
912 |
+ * ANSI C standard makes this an impossibility right from the |
53 |
* include stdint.h. The hope is that one or the other can be |
913 |
+ * very get go. Its really only meant to be useful for the vast |
54 |
* used with no real difference. |
914 |
+ * majority of platforms that possess the capability of |
55 |
* |
915 |
+ * implementing usefully and precisely defined, standard sized |
56 |
- * 5) In the current verison, if your platform can't represent |
916 |
+ * integer scalars. Systems which are not intrinsically 2s |
|
|
917 |
+ * complement may produce invalid constants. |
918 |
+ * |
919 |
+ * 2) There is an unavoidable use of non-reserved symbols. |
920 |
+ * |
921 |
+ * 3) Other standard include files are invoked. |
922 |
+ * |
923 |
+ * 4) This file may come in conflict with future platforms that do |
924 |
+ * include stdint.h. The hope is that one or the other can be |
925 |
+ * used with no real difference. |
926 |
+ * |
57 |
+ * 5) In the current version, if your platform can't represent |
927 |
+ * 5) In the current version, if your platform can't represent |
58 |
* int32_t, int16_t and int8_t, it just dumps out with a compiler |
928 |
+ * int32_t, int16_t and int8_t, it just dumps out with a compiler |
59 |
* error. |
929 |
+ * error. |
60 |
* |
930 |
+ * |
61 |
@@ -154,7 +152,12 @@ |
931 |
+ * 6) 64 bit integers may or may not be defined. Test for their |
62 |
* PRINTF_INT64_DEC_WIDTH |
932 |
+ * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. |
63 |
* PRINTF_INT32_DEC_WIDTH |
933 |
+ * Note that this is different from the C99 specification which |
64 |
* PRINTF_INT16_DEC_WIDTH |
934 |
+ * requires the existence of 64 bit support in the compiler. If |
65 |
- * PRINTF_INT8_DEC_WIDTH |
935 |
+ * this is not defined for your platform, yet it is capable of |
|
|
936 |
+ * dealing with 64 bits then it is because this file has not yet |
937 |
+ * been extended to cover all of your system's capabilities. |
938 |
+ * |
939 |
+ * 7) (u)intptr_t may or may not be defined. Test for its presence |
940 |
+ * with the test: #ifdef PTRDIFF_MAX. If this is not defined |
941 |
+ * for your platform, then it is because this file has not yet |
942 |
+ * been extended to cover all of your system's capabilities, not |
943 |
+ * because its optional. |
944 |
+ * |
945 |
+ * 8) The following might not been defined even if your platform is |
946 |
+ * capable of defining it: |
947 |
+ * |
948 |
+ * WCHAR_MIN |
949 |
+ * WCHAR_MAX |
950 |
+ * (u)int64_t |
951 |
+ * PTRDIFF_MIN |
952 |
+ * PTRDIFF_MAX |
953 |
+ * (u)intptr_t |
954 |
+ * |
955 |
+ * 9) The following have not been defined: |
956 |
+ * |
957 |
+ * WINT_MIN |
958 |
+ * WINT_MAX |
959 |
+ * |
960 |
+ * 10) The criteria for defining (u)int_least(*)_t isn't clear, |
961 |
+ * except for systems which don't have a type that precisely |
962 |
+ * defined 8, 16, or 32 bit types (which this include file does |
963 |
+ * not support anyways). Default definitions have been given. |
964 |
+ * |
965 |
+ * 11) The criteria for defining (u)int_fast(*)_t isn't something I |
966 |
+ * would trust to any particular compiler vendor or the ANSI C |
967 |
+ * committee. It is well known that "compatible systems" are |
968 |
+ * commonly created that have very different performance |
969 |
+ * characteristics from the systems they are compatible with, |
970 |
+ * especially those whose vendors make both the compiler and the |
971 |
+ * system. Default definitions have been given, but its strongly |
972 |
+ * recommended that users never use these definitions for any |
973 |
+ * reason (they do *NOT* deliver any serious guarantee of |
974 |
+ * improved performance -- not in this file, nor any vendor's |
975 |
+ * stdint.h). |
976 |
+ * |
977 |
+ * 12) The following macros: |
978 |
+ * |
979 |
+ * PRINTF_INTMAX_MODIFIER |
980 |
+ * PRINTF_INT64_MODIFIER |
981 |
+ * PRINTF_INT32_MODIFIER |
982 |
+ * PRINTF_INT16_MODIFIER |
983 |
+ * PRINTF_LEAST64_MODIFIER |
984 |
+ * PRINTF_LEAST32_MODIFIER |
985 |
+ * PRINTF_LEAST16_MODIFIER |
986 |
+ * PRINTF_INTPTR_MODIFIER |
987 |
+ * |
988 |
+ * are strings which have been defined as the modifiers required |
989 |
+ * for the "d", "u" and "x" printf formats to correctly output |
990 |
+ * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, |
991 |
+ * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. |
992 |
+ * PRINTF_INTPTR_MODIFIER is not defined for some systems which |
993 |
+ * provide their own stdint.h. PRINTF_INT64_MODIFIER is not |
994 |
+ * defined if INT64_MAX is not defined. These are an extension |
995 |
+ * beyond what C99 specifies must be in stdint.h. |
996 |
+ * |
997 |
+ * In addition, the following macros are defined: |
998 |
+ * |
999 |
+ * PRINTF_INTMAX_HEX_WIDTH |
1000 |
+ * PRINTF_INT64_HEX_WIDTH |
1001 |
+ * PRINTF_INT32_HEX_WIDTH |
1002 |
+ * PRINTF_INT16_HEX_WIDTH |
1003 |
+ * PRINTF_INT8_HEX_WIDTH |
1004 |
+ * PRINTF_INTMAX_DEC_WIDTH |
1005 |
+ * PRINTF_INT64_DEC_WIDTH |
1006 |
+ * PRINTF_INT32_DEC_WIDTH |
1007 |
+ * PRINTF_INT16_DEC_WIDTH |
66 |
+ * PRINTF_UINT8_DEC_WIDTH |
1008 |
+ * PRINTF_UINT8_DEC_WIDTH |
67 |
+ * PRINTF_UINTMAX_DEC_WIDTH |
1009 |
+ * PRINTF_UINTMAX_DEC_WIDTH |
68 |
+ * PRINTF_UINT64_DEC_WIDTH |
1010 |
+ * PRINTF_UINT64_DEC_WIDTH |
Lines 69-101
Link Here
|
69 |
+ * PRINTF_UINT32_DEC_WIDTH |
1011 |
+ * PRINTF_UINT32_DEC_WIDTH |
70 |
+ * PRINTF_UINT16_DEC_WIDTH |
1012 |
+ * PRINTF_UINT16_DEC_WIDTH |
71 |
+ * PRINTF_UINT8_DEC_WIDTH |
1013 |
+ * PRINTF_UINT8_DEC_WIDTH |
72 |
* |
1014 |
+ * |
73 |
* Which specifies the maximum number of characters required to |
1015 |
+ * Which specifies the maximum number of characters required to |
74 |
* print the number of that type in either hexadecimal or decimal. |
1016 |
+ * print the number of that type in either hexadecimal or decimal. |
75 |
@@ -178,6 +181,10 @@ |
1017 |
+ * These are an extension beyond what C99 specifies must be in |
76 |
* Chris Howie |
1018 |
+ * stdint.h. |
77 |
* John Steele Scott |
1019 |
+ * |
78 |
* Dave Thorup |
1020 |
+ * Compilers tested (all with 0 warnings at their highest respective |
|
|
1021 |
+ * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 |
1022 |
+ * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio |
1023 |
+ * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 |
1024 |
+ * |
1025 |
+ * This file should be considered a work in progress. Suggestions for |
1026 |
+ * improvements, especially those which increase coverage are strongly |
1027 |
+ * encouraged. |
1028 |
+ * |
1029 |
+ * Acknowledgements |
1030 |
+ * |
1031 |
+ * The following people have made significant contributions to the |
1032 |
+ * development and testing of this file: |
1033 |
+ * |
1034 |
+ * Chris Howie |
1035 |
+ * John Steele Scott |
1036 |
+ * Dave Thorup |
79 |
+ * John Dill |
1037 |
+ * John Dill |
80 |
+ * Florian Wobbe |
1038 |
+ * Florian Wobbe |
81 |
+ * Christopher Sean Morrison |
1039 |
+ * Christopher Sean Morrison |
82 |
+ * Mikkel Fahnoe Jorgensen |
1040 |
+ * Mikkel Fahnoe Jorgensen |
83 |
* |
1041 |
+ * |
84 |
*/ |
1042 |
+ */ |
85 |
|
1043 |
+ |
86 |
@@ -190,14 +197,27 @@ |
1044 |
+#include <stddef.h> |
87 |
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. |
1045 |
+#include <limits.h> |
88 |
*/ |
1046 |
+#include <signal.h> |
89 |
|
1047 |
+ |
90 |
-#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)))) && !defined (_PSTDINT_H_INCLUDED) && !defined(_STDINT) |
1048 |
+/* |
|
|
1049 |
+ * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and |
1050 |
+ * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. |
1051 |
+ */ |
1052 |
+ |
91 |
+#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) |
1053 |
+#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) |
92 |
#include <stdint.h> |
1054 |
+#include <stdint.h> |
93 |
#define _PSTDINT_H_INCLUDED |
1055 |
+#define _PSTDINT_H_INCLUDED |
94 |
-# ifndef PRINTF_INT64_MODIFIER |
|
|
95 |
-# define PRINTF_INT64_MODIFIER "ll" |
96 |
-# endif |
97 |
-# ifndef PRINTF_INT32_MODIFIER |
98 |
-# define PRINTF_INT32_MODIFIER "l" |
99 |
+# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) |
1056 |
+# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) |
100 |
+# ifndef PRINTF_INT64_MODIFIER |
1057 |
+# ifndef PRINTF_INT64_MODIFIER |
101 |
+# define PRINTF_INT64_MODIFIER "l" |
1058 |
+# define PRINTF_INT64_MODIFIER "l" |
Lines 114-193
Link Here
|
114 |
+# define PRINTF_INT32_MODIFIER "l" |
1071 |
+# define PRINTF_INT32_MODIFIER "l" |
115 |
+# endif |
1072 |
+# endif |
116 |
+# endif |
1073 |
+# endif |
117 |
# endif |
1074 |
+# endif |
118 |
# ifndef PRINTF_INT16_MODIFIER |
1075 |
+# ifndef PRINTF_INT16_MODIFIER |
119 |
# define PRINTF_INT16_MODIFIER "h" |
1076 |
+# define PRINTF_INT16_MODIFIER "h" |
120 |
@@ -208,32 +228,62 @@ |
1077 |
+# endif |
121 |
# ifndef PRINTF_INT64_HEX_WIDTH |
1078 |
+# ifndef PRINTF_INTMAX_MODIFIER |
122 |
# define PRINTF_INT64_HEX_WIDTH "16" |
1079 |
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER |
123 |
# endif |
1080 |
+# endif |
|
|
1081 |
+# ifndef PRINTF_INT64_HEX_WIDTH |
1082 |
+# define PRINTF_INT64_HEX_WIDTH "16" |
1083 |
+# endif |
124 |
+# ifndef PRINTF_UINT64_HEX_WIDTH |
1084 |
+# ifndef PRINTF_UINT64_HEX_WIDTH |
125 |
+# define PRINTF_UINT64_HEX_WIDTH "16" |
1085 |
+# define PRINTF_UINT64_HEX_WIDTH "16" |
126 |
+# endif |
1086 |
+# endif |
127 |
# ifndef PRINTF_INT32_HEX_WIDTH |
1087 |
+# ifndef PRINTF_INT32_HEX_WIDTH |
128 |
# define PRINTF_INT32_HEX_WIDTH "8" |
1088 |
+# define PRINTF_INT32_HEX_WIDTH "8" |
129 |
# endif |
1089 |
+# endif |
130 |
+# ifndef PRINTF_UINT32_HEX_WIDTH |
1090 |
+# ifndef PRINTF_UINT32_HEX_WIDTH |
131 |
+# define PRINTF_UINT32_HEX_WIDTH "8" |
1091 |
+# define PRINTF_UINT32_HEX_WIDTH "8" |
132 |
+# endif |
1092 |
+# endif |
133 |
# ifndef PRINTF_INT16_HEX_WIDTH |
1093 |
+# ifndef PRINTF_INT16_HEX_WIDTH |
134 |
# define PRINTF_INT16_HEX_WIDTH "4" |
1094 |
+# define PRINTF_INT16_HEX_WIDTH "4" |
135 |
# endif |
1095 |
+# endif |
136 |
+# ifndef PRINTF_UINT16_HEX_WIDTH |
1096 |
+# ifndef PRINTF_UINT16_HEX_WIDTH |
137 |
+# define PRINTF_UINT16_HEX_WIDTH "4" |
1097 |
+# define PRINTF_UINT16_HEX_WIDTH "4" |
138 |
+# endif |
1098 |
+# endif |
139 |
# ifndef PRINTF_INT8_HEX_WIDTH |
1099 |
+# ifndef PRINTF_INT8_HEX_WIDTH |
140 |
# define PRINTF_INT8_HEX_WIDTH "2" |
1100 |
+# define PRINTF_INT8_HEX_WIDTH "2" |
141 |
# endif |
1101 |
+# endif |
142 |
+# ifndef PRINTF_UINT8_HEX_WIDTH |
1102 |
+# ifndef PRINTF_UINT8_HEX_WIDTH |
143 |
+# define PRINTF_UINT8_HEX_WIDTH "2" |
1103 |
+# define PRINTF_UINT8_HEX_WIDTH "2" |
144 |
+# endif |
1104 |
+# endif |
145 |
# ifndef PRINTF_INT64_DEC_WIDTH |
1105 |
+# ifndef PRINTF_INT64_DEC_WIDTH |
146 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
|
|
147 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
1106 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
148 |
+# endif |
1107 |
+# endif |
149 |
+# ifndef PRINTF_UINT64_DEC_WIDTH |
1108 |
+# ifndef PRINTF_UINT64_DEC_WIDTH |
150 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
1109 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
151 |
# endif |
1110 |
+# endif |
152 |
# ifndef PRINTF_INT32_DEC_WIDTH |
1111 |
+# ifndef PRINTF_INT32_DEC_WIDTH |
153 |
# define PRINTF_INT32_DEC_WIDTH "10" |
1112 |
+# define PRINTF_INT32_DEC_WIDTH "10" |
154 |
# endif |
1113 |
+# endif |
155 |
+# ifndef PRINTF_UINT32_DEC_WIDTH |
1114 |
+# ifndef PRINTF_UINT32_DEC_WIDTH |
156 |
+# define PRINTF_UINT32_DEC_WIDTH "10" |
1115 |
+# define PRINTF_UINT32_DEC_WIDTH "10" |
157 |
+# endif |
1116 |
+# endif |
158 |
# ifndef PRINTF_INT16_DEC_WIDTH |
1117 |
+# ifndef PRINTF_INT16_DEC_WIDTH |
159 |
# define PRINTF_INT16_DEC_WIDTH "5" |
1118 |
+# define PRINTF_INT16_DEC_WIDTH "5" |
160 |
# endif |
1119 |
+# endif |
161 |
+# ifndef PRINTF_UINT16_DEC_WIDTH |
1120 |
+# ifndef PRINTF_UINT16_DEC_WIDTH |
162 |
+# define PRINTF_UINT16_DEC_WIDTH "5" |
1121 |
+# define PRINTF_UINT16_DEC_WIDTH "5" |
163 |
+# endif |
1122 |
+# endif |
164 |
# ifndef PRINTF_INT8_DEC_WIDTH |
1123 |
+# ifndef PRINTF_INT8_DEC_WIDTH |
165 |
# define PRINTF_INT8_DEC_WIDTH "3" |
1124 |
+# define PRINTF_INT8_DEC_WIDTH "3" |
166 |
# endif |
1125 |
+# endif |
167 |
+# ifndef PRINTF_UINT8_DEC_WIDTH |
1126 |
+# ifndef PRINTF_UINT8_DEC_WIDTH |
168 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
1127 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
169 |
+# endif |
1128 |
+# endif |
170 |
# ifndef PRINTF_INTMAX_HEX_WIDTH |
1129 |
+# ifndef PRINTF_INTMAX_HEX_WIDTH |
171 |
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH |
|
|
172 |
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
1130 |
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
173 |
+# endif |
1131 |
+# endif |
174 |
+# ifndef PRINTF_UINTMAX_HEX_WIDTH |
1132 |
+# ifndef PRINTF_UINTMAX_HEX_WIDTH |
175 |
+# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
1133 |
+# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
176 |
# endif |
1134 |
+# endif |
177 |
# ifndef PRINTF_INTMAX_DEC_WIDTH |
1135 |
+# ifndef PRINTF_INTMAX_DEC_WIDTH |
178 |
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH |
|
|
179 |
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
1136 |
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
180 |
+# endif |
1137 |
+# endif |
181 |
+# ifndef PRINTF_UINTMAX_DEC_WIDTH |
1138 |
+# ifndef PRINTF_UINTMAX_DEC_WIDTH |
182 |
+# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
1139 |
+# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
183 |
# endif |
1140 |
+# endif |
184 |
|
1141 |
+ |
185 |
/* |
|
|
186 |
@@ -287,6 +337,20 @@ |
187 |
# endif |
188 |
#endif |
189 |
|
190 |
+/* |
1142 |
+/* |
|
|
1143 |
+ * Something really weird is going on with Open Watcom. Just pull some of |
1144 |
+ * these duplicated definitions from Open Watcom's stdint.h file for now. |
1145 |
+ */ |
1146 |
+ |
1147 |
+# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 |
1148 |
+# if !defined (INT64_C) |
1149 |
+# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) |
1150 |
+# endif |
1151 |
+# if !defined (UINT64_C) |
1152 |
+# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) |
1153 |
+# endif |
1154 |
+# if !defined (INT32_C) |
1155 |
+# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) |
1156 |
+# endif |
1157 |
+# if !defined (UINT32_C) |
1158 |
+# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) |
1159 |
+# endif |
1160 |
+# if !defined (INT16_C) |
1161 |
+# define INT16_C(x) (x) |
1162 |
+# endif |
1163 |
+# if !defined (UINT16_C) |
1164 |
+# define UINT16_C(x) (x) |
1165 |
+# endif |
1166 |
+# if !defined (INT8_C) |
1167 |
+# define INT8_C(x) (x) |
1168 |
+# endif |
1169 |
+# if !defined (UINT8_C) |
1170 |
+# define UINT8_C(x) (x) |
1171 |
+# endif |
1172 |
+# if !defined (UINT64_MAX) |
1173 |
+# define UINT64_MAX 18446744073709551615ULL |
1174 |
+# endif |
1175 |
+# if !defined (INT64_MAX) |
1176 |
+# define INT64_MAX 9223372036854775807LL |
1177 |
+# endif |
1178 |
+# if !defined (UINT32_MAX) |
1179 |
+# define UINT32_MAX 4294967295UL |
1180 |
+# endif |
1181 |
+# if !defined (INT32_MAX) |
1182 |
+# define INT32_MAX 2147483647L |
1183 |
+# endif |
1184 |
+# if !defined (INTMAX_MAX) |
1185 |
+# define INTMAX_MAX INT64_MAX |
1186 |
+# endif |
1187 |
+# if !defined (INTMAX_MIN) |
1188 |
+# define INTMAX_MIN INT64_MIN |
1189 |
+# endif |
1190 |
+# endif |
1191 |
+#endif |
1192 |
+ |
1193 |
+/* |
191 |
+ * I have no idea what is the truly correct thing to do on older Solaris. |
1194 |
+ * I have no idea what is the truly correct thing to do on older Solaris. |
192 |
+ * From some online discussions, this seems to be what is being |
1195 |
+ * From some online discussions, this seems to be what is being |
193 |
+ * recommended. For people who actually are developing on older Solaris, |
1196 |
+ * recommended. For people who actually are developing on older Solaris, |
Lines 201-296
Link Here
|
201 |
+#define _PSTDINT_H_INCLUDED |
1204 |
+#define _PSTDINT_H_INCLUDED |
202 |
+#endif |
1205 |
+#endif |
203 |
+ |
1206 |
+ |
204 |
#ifndef _PSTDINT_H_INCLUDED |
1207 |
+#ifndef _PSTDINT_H_INCLUDED |
205 |
#define _PSTDINT_H_INCLUDED |
1208 |
+#define _PSTDINT_H_INCLUDED |
206 |
|
1209 |
+ |
207 |
@@ -303,7 +367,7 @@ |
1210 |
+#ifndef SIZE_MAX |
208 |
#ifndef UINT8_MAX |
1211 |
+# define SIZE_MAX (~(size_t)0) |
209 |
# define UINT8_MAX 0xff |
1212 |
+#endif |
210 |
#endif |
1213 |
+ |
211 |
-#ifndef uint8_t |
1214 |
+/* |
|
|
1215 |
+ * Deduce the type assignments from limits.h under the assumption that |
1216 |
+ * integer sizes in bits are powers of 2, and follow the ANSI |
1217 |
+ * definitions. |
1218 |
+ */ |
1219 |
+ |
1220 |
+#ifndef UINT8_MAX |
1221 |
+# define UINT8_MAX 0xff |
1222 |
+#endif |
212 |
+#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks) |
1223 |
+#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks) |
213 |
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) |
1224 |
+# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) |
214 |
typedef unsigned char uint8_t; |
1225 |
+ typedef unsigned char uint8_t; |
215 |
# define UINT8_C(v) ((uint8_t) v) |
1226 |
+# define UINT8_C(v) ((uint8_t) v) |
216 |
@@ -318,7 +382,7 @@ |
1227 |
+# else |
217 |
#ifndef INT8_MIN |
1228 |
+# error "Platform not supported" |
218 |
# define INT8_MIN INT8_C(0x80) |
1229 |
+# endif |
219 |
#endif |
1230 |
+#endif |
220 |
-#ifndef int8_t |
1231 |
+ |
|
|
1232 |
+#ifndef INT8_MAX |
1233 |
+# define INT8_MAX 0x7f |
1234 |
+#endif |
1235 |
+#ifndef INT8_MIN |
1236 |
+# define INT8_MIN INT8_C(0x80) |
1237 |
+#endif |
221 |
+#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks) |
1238 |
+#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks) |
222 |
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) |
1239 |
+# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) |
223 |
typedef signed char int8_t; |
1240 |
+ typedef signed char int8_t; |
224 |
# define INT8_C(v) ((int8_t) v) |
1241 |
+# define INT8_C(v) ((int8_t) v) |
225 |
@@ -330,7 +394,7 @@ |
1242 |
+# else |
226 |
#ifndef UINT16_MAX |
1243 |
+# error "Platform not supported" |
227 |
# define UINT16_MAX 0xffff |
1244 |
+# endif |
228 |
#endif |
1245 |
+#endif |
229 |
-#ifndef uint16_t |
1246 |
+ |
|
|
1247 |
+#ifndef UINT16_MAX |
1248 |
+# define UINT16_MAX 0xffff |
1249 |
+#endif |
230 |
+#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks) |
1250 |
+#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks) |
231 |
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) |
1251 |
+#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) |
232 |
typedef unsigned int uint16_t; |
1252 |
+ typedef unsigned int uint16_t; |
233 |
# ifndef PRINTF_INT16_MODIFIER |
1253 |
+# ifndef PRINTF_INT16_MODIFIER |
234 |
@@ -354,7 +418,7 @@ |
1254 |
+# define PRINTF_INT16_MODIFIER "" |
235 |
#ifndef INT16_MIN |
1255 |
+# endif |
236 |
# define INT16_MIN INT16_C(0x8000) |
1256 |
+# define UINT16_C(v) ((uint16_t) (v)) |
237 |
#endif |
1257 |
+#elif (USHRT_MAX == UINT16_MAX) |
238 |
-#ifndef int16_t |
1258 |
+ typedef unsigned short uint16_t; |
|
|
1259 |
+# define UINT16_C(v) ((uint16_t) (v)) |
1260 |
+# ifndef PRINTF_INT16_MODIFIER |
1261 |
+# define PRINTF_INT16_MODIFIER "h" |
1262 |
+# endif |
1263 |
+#else |
1264 |
+#error "Platform not supported" |
1265 |
+#endif |
1266 |
+#endif |
1267 |
+ |
1268 |
+#ifndef INT16_MAX |
1269 |
+# define INT16_MAX 0x7fff |
1270 |
+#endif |
1271 |
+#ifndef INT16_MIN |
1272 |
+# define INT16_MIN INT16_C(0x8000) |
1273 |
+#endif |
239 |
+#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks) |
1274 |
+#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks) |
240 |
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) |
1275 |
+#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) |
241 |
typedef signed int int16_t; |
1276 |
+ typedef signed int int16_t; |
242 |
# define INT16_C(v) ((int16_t) (v)) |
1277 |
+# define INT16_C(v) ((int16_t) (v)) |
243 |
@@ -375,7 +439,7 @@ |
1278 |
+# ifndef PRINTF_INT16_MODIFIER |
244 |
#ifndef UINT32_MAX |
1279 |
+# define PRINTF_INT16_MODIFIER "" |
245 |
# define UINT32_MAX (0xffffffffUL) |
1280 |
+# endif |
246 |
#endif |
1281 |
+#elif (SHRT_MAX == INT16_MAX) |
247 |
-#ifndef uint32_t |
1282 |
+ typedef signed short int16_t; |
|
|
1283 |
+# define INT16_C(v) ((int16_t) (v)) |
1284 |
+# ifndef PRINTF_INT16_MODIFIER |
1285 |
+# define PRINTF_INT16_MODIFIER "h" |
1286 |
+# endif |
1287 |
+#else |
1288 |
+#error "Platform not supported" |
1289 |
+#endif |
1290 |
+#endif |
1291 |
+ |
1292 |
+#ifndef UINT32_MAX |
1293 |
+# define UINT32_MAX (0xffffffffUL) |
1294 |
+#endif |
248 |
+#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks) |
1295 |
+#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks) |
249 |
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) |
1296 |
+#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) |
250 |
typedef unsigned long uint32_t; |
1297 |
+ typedef unsigned long uint32_t; |
251 |
# define UINT32_C(v) v ## UL |
1298 |
+# define UINT32_C(v) v ## UL |
252 |
@@ -405,7 +469,7 @@ |
1299 |
+# ifndef PRINTF_INT32_MODIFIER |
253 |
#ifndef INT32_MIN |
1300 |
+# define PRINTF_INT32_MODIFIER "l" |
254 |
# define INT32_MIN INT32_C(0x80000000) |
1301 |
+# endif |
255 |
#endif |
1302 |
+#elif (UINT_MAX == UINT32_MAX) |
256 |
-#ifndef int32_t |
1303 |
+ typedef unsigned int uint32_t; |
|
|
1304 |
+# ifndef PRINTF_INT32_MODIFIER |
1305 |
+# define PRINTF_INT32_MODIFIER "" |
1306 |
+# endif |
1307 |
+# define UINT32_C(v) v ## U |
1308 |
+#elif (USHRT_MAX == UINT32_MAX) |
1309 |
+ typedef unsigned short uint32_t; |
1310 |
+# define UINT32_C(v) ((unsigned short) (v)) |
1311 |
+# ifndef PRINTF_INT32_MODIFIER |
1312 |
+# define PRINTF_INT32_MODIFIER "" |
1313 |
+# endif |
1314 |
+#else |
1315 |
+#error "Platform not supported" |
1316 |
+#endif |
1317 |
+#endif |
1318 |
+ |
1319 |
+#ifndef INT32_MAX |
1320 |
+# define INT32_MAX (0x7fffffffL) |
1321 |
+#endif |
1322 |
+#ifndef INT32_MIN |
1323 |
+# define INT32_MIN INT32_C(0x80000000) |
1324 |
+#endif |
257 |
+#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks) |
1325 |
+#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks) |
258 |
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) |
1326 |
+#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) |
259 |
typedef signed long int32_t; |
1327 |
+ typedef signed long int32_t; |
260 |
# define INT32_C(v) v ## L |
1328 |
+# define INT32_C(v) v ## L |
261 |
@@ -438,7 +502,7 @@ |
1329 |
+# ifndef PRINTF_INT32_MODIFIER |
262 |
|
1330 |
+# define PRINTF_INT32_MODIFIER "l" |
263 |
#undef stdint_int64_defined |
1331 |
+# endif |
264 |
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) |
1332 |
+#elif (INT_MAX == INT32_MAX) |
265 |
-# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S) |
1333 |
+ typedef signed int int32_t; |
|
|
1334 |
+# define INT32_C(v) v |
1335 |
+# ifndef PRINTF_INT32_MODIFIER |
1336 |
+# define PRINTF_INT32_MODIFIER "" |
1337 |
+# endif |
1338 |
+#elif (SHRT_MAX == INT32_MAX) |
1339 |
+ typedef signed short int32_t; |
1340 |
+# define INT32_C(v) ((short) (v)) |
1341 |
+# ifndef PRINTF_INT32_MODIFIER |
1342 |
+# define PRINTF_INT32_MODIFIER "" |
1343 |
+# endif |
1344 |
+#else |
1345 |
+#error "Platform not supported" |
1346 |
+#endif |
1347 |
+#endif |
1348 |
+ |
1349 |
+/* |
1350 |
+ * The macro stdint_int64_defined is temporarily used to record |
1351 |
+ * whether or not 64 integer support is available. It must be |
1352 |
+ * defined for any 64 integer extensions for new platforms that are |
1353 |
+ * added. |
1354 |
+ */ |
1355 |
+ |
1356 |
+#undef stdint_int64_defined |
1357 |
+#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) |
266 |
+# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) |
1358 |
+# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) |
267 |
# define stdint_int64_defined |
1359 |
+# define stdint_int64_defined |
268 |
typedef long long int64_t; |
1360 |
+ typedef long long int64_t; |
269 |
typedef unsigned long long uint64_t; |
1361 |
+ typedef unsigned long long uint64_t; |
270 |
@@ -451,7 +515,7 @@ |
1362 |
+# define UINT64_C(v) v ## ULL |
271 |
#endif |
1363 |
+# define INT64_C(v) v ## LL |
272 |
|
1364 |
+# ifndef PRINTF_INT64_MODIFIER |
273 |
#if !defined (stdint_int64_defined) |
1365 |
+# define PRINTF_INT64_MODIFIER "ll" |
274 |
-# if defined(__GNUC__) |
1366 |
+# endif |
|
|
1367 |
+# endif |
1368 |
+#endif |
1369 |
+ |
1370 |
+#if !defined (stdint_int64_defined) |
275 |
+# if defined(__GNUC__) && !defined(vxWorks) |
1371 |
+# if defined(__GNUC__) && !defined(vxWorks) |
276 |
# define stdint_int64_defined |
1372 |
+# define stdint_int64_defined |
277 |
__extension__ typedef long long int64_t; |
1373 |
+ __extension__ typedef long long int64_t; |
278 |
__extension__ typedef unsigned long long uint64_t; |
1374 |
+ __extension__ typedef unsigned long long uint64_t; |
279 |
@@ -514,9 +578,8 @@ |
1375 |
+# define UINT64_C(v) v ## ULL |
280 |
#ifndef PRINTF_INT8_HEX_WIDTH |
1376 |
+# define INT64_C(v) v ## LL |
281 |
# define PRINTF_INT8_HEX_WIDTH "2" |
1377 |
+# ifndef PRINTF_INT64_MODIFIER |
282 |
#endif |
1378 |
+# define PRINTF_INT64_MODIFIER "ll" |
283 |
- |
1379 |
+# endif |
284 |
#ifndef PRINTF_INT64_DEC_WIDTH |
1380 |
+# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) |
285 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
1381 |
+# define stdint_int64_defined |
|
|
1382 |
+ typedef long long int64_t; |
1383 |
+ typedef unsigned long long uint64_t; |
1384 |
+# define UINT64_C(v) v ## ULL |
1385 |
+# define INT64_C(v) v ## LL |
1386 |
+# ifndef PRINTF_INT64_MODIFIER |
1387 |
+# define PRINTF_INT64_MODIFIER "ll" |
1388 |
+# endif |
1389 |
+# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) |
1390 |
+# define stdint_int64_defined |
1391 |
+ typedef __int64 int64_t; |
1392 |
+ typedef unsigned __int64 uint64_t; |
1393 |
+# define UINT64_C(v) v ## UI64 |
1394 |
+# define INT64_C(v) v ## I64 |
1395 |
+# ifndef PRINTF_INT64_MODIFIER |
1396 |
+# define PRINTF_INT64_MODIFIER "I64" |
1397 |
+# endif |
1398 |
+# endif |
1399 |
+#endif |
1400 |
+ |
1401 |
+#if !defined (LONG_LONG_MAX) && defined (INT64_C) |
1402 |
+# define LONG_LONG_MAX INT64_C (9223372036854775807) |
1403 |
+#endif |
1404 |
+#ifndef ULONG_LONG_MAX |
1405 |
+# define ULONG_LONG_MAX UINT64_C (18446744073709551615) |
1406 |
+#endif |
1407 |
+ |
1408 |
+#if !defined (INT64_MAX) && defined (INT64_C) |
1409 |
+# define INT64_MAX INT64_C (9223372036854775807) |
1410 |
+#endif |
1411 |
+#if !defined (INT64_MIN) && defined (INT64_C) |
1412 |
+# define INT64_MIN INT64_C (-9223372036854775808) |
1413 |
+#endif |
1414 |
+#if !defined (UINT64_MAX) && defined (INT64_C) |
1415 |
+# define UINT64_MAX UINT64_C (18446744073709551615) |
1416 |
+#endif |
1417 |
+ |
1418 |
+/* |
1419 |
+ * Width of hexadecimal for number field. |
1420 |
+ */ |
1421 |
+ |
1422 |
+#ifndef PRINTF_INT64_HEX_WIDTH |
1423 |
+# define PRINTF_INT64_HEX_WIDTH "16" |
1424 |
+#endif |
1425 |
+#ifndef PRINTF_INT32_HEX_WIDTH |
1426 |
+# define PRINTF_INT32_HEX_WIDTH "8" |
1427 |
+#endif |
1428 |
+#ifndef PRINTF_INT16_HEX_WIDTH |
1429 |
+# define PRINTF_INT16_HEX_WIDTH "4" |
1430 |
+#endif |
1431 |
+#ifndef PRINTF_INT8_HEX_WIDTH |
1432 |
+# define PRINTF_INT8_HEX_WIDTH "2" |
1433 |
+#endif |
1434 |
+#ifndef PRINTF_INT64_DEC_WIDTH |
286 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
1435 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
287 |
#endif |
1436 |
+#endif |
288 |
#ifndef PRINTF_INT32_DEC_WIDTH |
1437 |
+#ifndef PRINTF_INT32_DEC_WIDTH |
289 |
# define PRINTF_INT32_DEC_WIDTH "10" |
1438 |
+# define PRINTF_INT32_DEC_WIDTH "10" |
290 |
@@ -527,6 +590,18 @@ |
1439 |
+#endif |
291 |
#ifndef PRINTF_INT8_DEC_WIDTH |
1440 |
+#ifndef PRINTF_INT16_DEC_WIDTH |
292 |
# define PRINTF_INT8_DEC_WIDTH "3" |
1441 |
+# define PRINTF_INT16_DEC_WIDTH "5" |
293 |
#endif |
1442 |
+#endif |
|
|
1443 |
+#ifndef PRINTF_INT8_DEC_WIDTH |
1444 |
+# define PRINTF_INT8_DEC_WIDTH "3" |
1445 |
+#endif |
294 |
+#ifndef PRINTF_UINT64_DEC_WIDTH |
1446 |
+#ifndef PRINTF_UINT64_DEC_WIDTH |
295 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
1447 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
296 |
+#endif |
1448 |
+#endif |
Lines 303-354
Link Here
|
303 |
+#ifndef PRINTF_UINT8_DEC_WIDTH |
1455 |
+#ifndef PRINTF_UINT8_DEC_WIDTH |
304 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
1456 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
305 |
+#endif |
1457 |
+#endif |
306 |
|
1458 |
+ |
307 |
/* |
1459 |
+/* |
308 |
* Ok, lets not worry about 128 bit integers for now. Moore's law says |
1460 |
+ * Ok, lets not worry about 128 bit integers for now. Moore's law says |
309 |
@@ -646,7 +721,7 @@ typedef uint_least32_t uint_fast32_t; |
1461 |
+ * we don't need to worry about that until about 2040 at which point |
310 |
* type limits. |
1462 |
+ * we'll have bigger things to worry about. |
311 |
*/ |
1463 |
+ */ |
312 |
|
1464 |
+ |
313 |
-#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) |
1465 |
+#ifdef stdint_int64_defined |
|
|
1466 |
+ typedef int64_t intmax_t; |
1467 |
+ typedef uint64_t uintmax_t; |
1468 |
+# define INTMAX_MAX INT64_MAX |
1469 |
+# define INTMAX_MIN INT64_MIN |
1470 |
+# define UINTMAX_MAX UINT64_MAX |
1471 |
+# define UINTMAX_C(v) UINT64_C(v) |
1472 |
+# define INTMAX_C(v) INT64_C(v) |
1473 |
+# ifndef PRINTF_INTMAX_MODIFIER |
1474 |
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER |
1475 |
+# endif |
1476 |
+# ifndef PRINTF_INTMAX_HEX_WIDTH |
1477 |
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH |
1478 |
+# endif |
1479 |
+# ifndef PRINTF_INTMAX_DEC_WIDTH |
1480 |
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH |
1481 |
+# endif |
1482 |
+#else |
1483 |
+ typedef int32_t intmax_t; |
1484 |
+ typedef uint32_t uintmax_t; |
1485 |
+# define INTMAX_MAX INT32_MAX |
1486 |
+# define UINTMAX_MAX UINT32_MAX |
1487 |
+# define UINTMAX_C(v) UINT32_C(v) |
1488 |
+# define INTMAX_C(v) INT32_C(v) |
1489 |
+# ifndef PRINTF_INTMAX_MODIFIER |
1490 |
+# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER |
1491 |
+# endif |
1492 |
+# ifndef PRINTF_INTMAX_HEX_WIDTH |
1493 |
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH |
1494 |
+# endif |
1495 |
+# ifndef PRINTF_INTMAX_DEC_WIDTH |
1496 |
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH |
1497 |
+# endif |
1498 |
+#endif |
1499 |
+ |
1500 |
+/* |
1501 |
+ * Because this file currently only supports platforms which have |
1502 |
+ * precise powers of 2 as bit sizes for the default integers, the |
1503 |
+ * least definitions are all trivial. Its possible that a future |
1504 |
+ * version of this file could have different definitions. |
1505 |
+ */ |
1506 |
+ |
1507 |
+#ifndef stdint_least_defined |
1508 |
+ typedef int8_t int_least8_t; |
1509 |
+ typedef uint8_t uint_least8_t; |
1510 |
+ typedef int16_t int_least16_t; |
1511 |
+ typedef uint16_t uint_least16_t; |
1512 |
+ typedef int32_t int_least32_t; |
1513 |
+ typedef uint32_t uint_least32_t; |
1514 |
+# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER |
1515 |
+# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER |
1516 |
+# define UINT_LEAST8_MAX UINT8_MAX |
1517 |
+# define INT_LEAST8_MAX INT8_MAX |
1518 |
+# define UINT_LEAST16_MAX UINT16_MAX |
1519 |
+# define INT_LEAST16_MAX INT16_MAX |
1520 |
+# define UINT_LEAST32_MAX UINT32_MAX |
1521 |
+# define INT_LEAST32_MAX INT32_MAX |
1522 |
+# define INT_LEAST8_MIN INT8_MIN |
1523 |
+# define INT_LEAST16_MIN INT16_MIN |
1524 |
+# define INT_LEAST32_MIN INT32_MIN |
1525 |
+# ifdef stdint_int64_defined |
1526 |
+ typedef int64_t int_least64_t; |
1527 |
+ typedef uint64_t uint_least64_t; |
1528 |
+# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER |
1529 |
+# define UINT_LEAST64_MAX UINT64_MAX |
1530 |
+# define INT_LEAST64_MAX INT64_MAX |
1531 |
+# define INT_LEAST64_MIN INT64_MIN |
1532 |
+# endif |
1533 |
+#endif |
1534 |
+#undef stdint_least_defined |
1535 |
+ |
1536 |
+/* |
1537 |
+ * The ANSI C committee pretending to know or specify anything about |
1538 |
+ * performance is the epitome of misguided arrogance. The mandate of |
1539 |
+ * this file is to *ONLY* ever support that absolute minimum |
1540 |
+ * definition of the fast integer types, for compatibility purposes. |
1541 |
+ * No extensions, and no attempt to suggest what may or may not be a |
1542 |
+ * faster integer type will ever be made in this file. Developers are |
1543 |
+ * warned to stay away from these types when using this or any other |
1544 |
+ * stdint.h. |
1545 |
+ */ |
1546 |
+ |
1547 |
+typedef int_least8_t int_fast8_t; |
1548 |
+typedef uint_least8_t uint_fast8_t; |
1549 |
+typedef int_least16_t int_fast16_t; |
1550 |
+typedef uint_least16_t uint_fast16_t; |
1551 |
+typedef int_least32_t int_fast32_t; |
1552 |
+typedef uint_least32_t uint_fast32_t; |
1553 |
+#define UINT_FAST8_MAX UINT_LEAST8_MAX |
1554 |
+#define INT_FAST8_MAX INT_LEAST8_MAX |
1555 |
+#define UINT_FAST16_MAX UINT_LEAST16_MAX |
1556 |
+#define INT_FAST16_MAX INT_LEAST16_MAX |
1557 |
+#define UINT_FAST32_MAX UINT_LEAST32_MAX |
1558 |
+#define INT_FAST32_MAX INT_LEAST32_MAX |
1559 |
+#define INT_FAST8_MIN INT_LEAST8_MIN |
1560 |
+#define INT_FAST16_MIN INT_LEAST16_MIN |
1561 |
+#define INT_FAST32_MIN INT_LEAST32_MIN |
1562 |
+#ifdef stdint_int64_defined |
1563 |
+ typedef int_least64_t int_fast64_t; |
1564 |
+ typedef uint_least64_t uint_fast64_t; |
1565 |
+# define UINT_FAST64_MAX UINT_LEAST64_MAX |
1566 |
+# define INT_FAST64_MAX INT_LEAST64_MAX |
1567 |
+# define INT_FAST64_MIN INT_LEAST64_MIN |
1568 |
+#endif |
1569 |
+ |
1570 |
+#undef stdint_int64_defined |
1571 |
+ |
1572 |
+/* |
1573 |
+ * Whatever piecemeal, per compiler thing we can do about the wchar_t |
1574 |
+ * type limits. |
1575 |
+ */ |
1576 |
+ |
314 |
+#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks) |
1577 |
+#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks) |
315 |
# include <wchar.h> |
1578 |
+# include <wchar.h> |
316 |
# ifndef WCHAR_MIN |
1579 |
+# ifndef WCHAR_MIN |
317 |
# define WCHAR_MIN 0 |
1580 |
+# define WCHAR_MIN 0 |
318 |
@@ -661,12 +736,12 @@ typedef uint_least32_t uint_fast32_t; |
1581 |
+# endif |
319 |
* (u)intptr_t types and limits. |
1582 |
+# ifndef WCHAR_MAX |
320 |
*/ |
1583 |
+# define WCHAR_MAX ((wchar_t)-1) |
321 |
|
1584 |
+# endif |
322 |
-#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) |
1585 |
+#endif |
|
|
1586 |
+ |
1587 |
+/* |
1588 |
+ * Whatever piecemeal, per compiler/platform thing we can do about the |
1589 |
+ * (u)intptr_t types and limits. |
1590 |
+ */ |
1591 |
+ |
323 |
+#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) |
1592 |
+#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) |
324 |
# define STDINT_H_UINTPTR_T_DEFINED |
1593 |
+# define STDINT_H_UINTPTR_T_DEFINED |
325 |
#endif |
1594 |
+#endif |
326 |
|
1595 |
+ |
327 |
#ifndef STDINT_H_UINTPTR_T_DEFINED |
1596 |
+#ifndef STDINT_H_UINTPTR_T_DEFINED |
328 |
-# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) |
|
|
329 |
+# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) |
1597 |
+# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) |
330 |
# define stdint_intptr_bits 64 |
1598 |
+# define stdint_intptr_bits 64 |
331 |
# elif defined (__WATCOMC__) || defined (__TURBOC__) |
1599 |
+# elif defined (__WATCOMC__) || defined (__TURBOC__) |
332 |
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) |
1600 |
+# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) |
333 |
@@ -674,10 +749,12 @@ typedef uint_least32_t uint_fast32_t; |
1601 |
+# define stdint_intptr_bits 16 |
334 |
# else |
1602 |
+# else |
335 |
# define stdint_intptr_bits 32 |
1603 |
+# define stdint_intptr_bits 32 |
336 |
# endif |
1604 |
+# endif |
337 |
-# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) |
|
|
338 |
+# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) |
1605 |
+# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) |
339 |
# define stdint_intptr_bits 32 |
1606 |
+# define stdint_intptr_bits 32 |
340 |
# elif defined (__INTEL_COMPILER) |
1607 |
+# elif defined (__INTEL_COMPILER) |
341 |
-/* TODO -- what will Intel do about x86-64? */ |
|
|
342 |
+/* TODO -- what did Intel do about x86-64? */ |
1608 |
+/* TODO -- what did Intel do about x86-64? */ |
343 |
+# else |
1609 |
+# else |
344 |
+/* #error "This platform might not be supported yet" */ |
1610 |
+/* #error "This platform might not be supported yet" */ |
345 |
# endif |
1611 |
+# endif |
346 |
|
1612 |
+ |
347 |
# ifdef stdint_intptr_bits |
1613 |
+# ifdef stdint_intptr_bits |
348 |
@@ -727,3 +804,109 @@ typedef uint_least32_t uint_fast32_t; |
1614 |
+# define stdint_intptr_glue3_i(a,b,c) a##b##c |
349 |
|
1615 |
+# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) |
350 |
#endif |
1616 |
+# ifndef PRINTF_INTPTR_MODIFIER |
351 |
|
1617 |
+# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) |
|
|
1618 |
+# endif |
1619 |
+# ifndef PTRDIFF_MAX |
1620 |
+# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) |
1621 |
+# endif |
1622 |
+# ifndef PTRDIFF_MIN |
1623 |
+# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) |
1624 |
+# endif |
1625 |
+# ifndef UINTPTR_MAX |
1626 |
+# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) |
1627 |
+# endif |
1628 |
+# ifndef INTPTR_MAX |
1629 |
+# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) |
1630 |
+# endif |
1631 |
+# ifndef INTPTR_MIN |
1632 |
+# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) |
1633 |
+# endif |
1634 |
+# ifndef INTPTR_C |
1635 |
+# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) |
1636 |
+# endif |
1637 |
+# ifndef UINTPTR_C |
1638 |
+# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) |
1639 |
+# endif |
1640 |
+ typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; |
1641 |
+ typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; |
1642 |
+# else |
1643 |
+/* TODO -- This following is likely wrong for some platforms, and does |
1644 |
+ nothing for the definition of uintptr_t. */ |
1645 |
+ typedef ptrdiff_t intptr_t; |
1646 |
+# endif |
1647 |
+# define STDINT_H_UINTPTR_T_DEFINED |
1648 |
+#endif |
1649 |
+ |
1650 |
+/* |
1651 |
+ * Assumes sig_atomic_t is signed and we have a 2s complement machine. |
1652 |
+ */ |
1653 |
+ |
1654 |
+#ifndef SIG_ATOMIC_MAX |
1655 |
+# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) |
1656 |
+#endif |
1657 |
+ |
1658 |
+#endif |
1659 |
+ |
352 |
+#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) |
1660 |
+#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) |
353 |
+ |
1661 |
+ |
354 |
+/* |
1662 |
+/* |