3 * Copyright (c) 2005 Paul Hsieh
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must not misrepresent the orignal
13 * source in the documentation and/or other materials provided
14 * with the distribution.
16 * The names of the authors not its contributors may be used to
17 * endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 * OF THE POSSIBILITY OF SUCH DAMAGE.
33 ****************************************************************************
37 * The ANSI C standard committee, for the C99 standard, specified the
38 * inclusion of a new standard include file called stdint.h. This is
39 * a very useful and long desired include file which contains several
40 * very precise definitions for integer scalar types that is
41 * critically important for making portable several classes of
42 * applications including cryptography, hashing, variable length
43 * integer libraries and so on. But for most developers its likely
44 * useful just for programming sanity.
46 * The problem is that most compiler vendors have decided not to
47 * implement the C99 standard, and the next C++ language standard
48 * (which has a lot more mindshare these days) will be a long time in
49 * coming and its unknown whether or not it will include stdint.h or
50 * how much adoption it will have. Either way, it will be a long time
51 * before all compilers come with a stdint.h and it also does nothing
52 * for the extremely large number of compilers available today which
53 * do not include this file, or anything comparable to it.
55 * So that's what this file is all about. Its an attempt to build a
56 * single universal include file that works on as many platforms as
57 * possible to deliver what stdint.h is supposed to. A few things
58 * that should be noted about this file:
60 * 1) It is not guaranteed to be portable and/or present an identical
61 * interface on all platforms. The extreme variability of the
62 * ANSI C standard makes this an impossibility right from the
63 * very get go. Its really only meant to be useful for the vast
64 * majority of platforms that possess the capability of
65 * implementing usefully and precisely defined, standard sized
66 * integer scalars. Systems which are not intrinsically 2s
67 * complement may produce invalid constants.
69 * 2) There is an unavoidable use of non-reserved symbols.
71 * 3) Other standard include files are invoked.
73 * 4) This file may come in conflict with future platforms that do
74 * include stdint.h. The hope is that one or the other can be
75 * used with no real difference.
77 * 5) In the current verison, if your platform can't represent
78 * int32_t, int16_t and int8_t, it just dumps out with a compiler
81 * 6) 64 bit integers may or may not be defined. Test for their
82 * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
83 * Note that this is different from the C99 specification which
84 * requires the existence of 64 bit support in the compiler. If
85 * this is not defined for your platform, yet it is capable of
86 * dealing with 64 bits then it is because this file has not yet
87 * been extended to cover all of your system's capabilities.
89 * 7) (u)intptr_t may or may not be defined. Test for its presence
90 * with the test: #ifdef PTRDIFF_MAX. If this is not defined
91 * for your platform, then it is because this file has not yet
92 * been extended to cover all of your system's capabilities, not
93 * because its optional.
95 * 8) The following might not been defined even if your platform is
96 * capable of defining it:
105 * 9) The following have not been defined:
110 * 10) The criteria for defining (u)int_least(*)_t isn't clear,
111 * except for systems which don't have a type that precisely
112 * defined 8, 16, or 32 bit types (which this include file does
113 * not support anyways). Default definitions have been given.
115 * 11) The criteria for defining (u)int_fast(*)_t isn't something I
116 * would trust to any particular compiler vendor or the ANSI C
117 * comittee. It is well known that "compatible systems" are
118 * commonly created that have very different performance
119 * characteristics from the systems they are compatible with,
120 * especially those whose vendors make both the compiler and the
121 * system. Default definitions have been given, but its strongly
122 * recommended that users never use these definitions for any
123 * reason (they do *NOT* deliver any serious guarantee of
124 * improved performance -- not in this file, nor any vendor's
127 * 12) The following macros:
129 * PRINTF_INTMAX_MODIFIER
130 * PRINTF_INT64_MODIFIER
131 * PRINTF_INT32_MODIFIER
132 * PRINTF_INT16_MODIFIER
133 * PRINTF_LEAST64_MODIFIER
134 * PRINTF_LEAST32_MODIFIER
135 * PRINTF_LEAST16_MODIFIER
136 * PRINTF_INTPTR_MODIFIER
138 * are strings which have been defined as the modifiers required
139 * for the "d", "u" and "x" printf formats to correctly output
140 * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
141 * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
142 * PRINTF_INTPTR_MODIFIER is not defined for some systems which
143 * provide their own stdint.h. PRINTF_INT64_MODIFIER is not
144 * defined if INT64_MAX is not defined. These are an extension
145 * beyond what C99 specifies must be in stdint.h.
147 * In addition, the following macros are defined:
149 * PRINTF_INTMAX_HEX_WIDTH
150 * PRINTF_INT64_HEX_WIDTH
151 * PRINTF_INT32_HEX_WIDTH
152 * PRINTF_INT16_HEX_WIDTH
153 * PRINTF_INT8_HEX_WIDTH
154 * PRINTF_INTMAX_DEC_WIDTH
155 * PRINTF_INT64_DEC_WIDTH
156 * PRINTF_INT32_DEC_WIDTH
157 * PRINTF_INT16_DEC_WIDTH
158 * PRINTF_INT8_DEC_WIDTH
160 * Which specifies the maximum number of characters required to
161 * print the number of that type in either hexadecimal or decimal.
162 * These are an extension beyond what C99 specifies must be in
165 * Compilers tested (all with 0 warnings at their highest respective
166 * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
167 * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
168 * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
170 * This file should be considered a work in progress. Suggestions for
171 * improvements, especially those which increase coverage are strongly
176 * The following people have made significant contributions to the
177 * development and testing of this file:
189 * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
193 #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && defined(_STDINT_H))) && !defined (_PSTDINT_H_INCLUDED)
195 #define _PSTDINT_H_INCLUDED
196 # ifndef PRINTF_INT64_MODIFIER
197 # define PRINTF_INT64_MODIFIER "ll"
199 # ifndef PRINTF_INT32_MODIFIER
200 # define PRINTF_INT32_MODIFIER "l"
202 # ifndef PRINTF_INT16_MODIFIER
203 # define PRINTF_INT16_MODIFIER "h"
205 # ifndef PRINTF_INTMAX_MODIFIER
206 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
208 # ifndef PRINTF_INT64_HEX_WIDTH
209 # define PRINTF_INT64_HEX_WIDTH "16"
211 # ifndef PRINTF_INT32_HEX_WIDTH
212 # define PRINTF_INT32_HEX_WIDTH "8"
214 # ifndef PRINTF_INT16_HEX_WIDTH
215 # define PRINTF_INT16_HEX_WIDTH "4"
217 # ifndef PRINTF_INT8_HEX_WIDTH
218 # define PRINTF_INT8_HEX_WIDTH "2"
220 # ifndef PRINTF_INT64_DEC_WIDTH
221 # define PRINTF_INT64_DEC_WIDTH "20"
223 # ifndef PRINTF_INT32_DEC_WIDTH
224 # define PRINTF_INT32_DEC_WIDTH "10"
226 # ifndef PRINTF_INT16_DEC_WIDTH
227 # define PRINTF_INT16_DEC_WIDTH "5"
229 # ifndef PRINTF_INT8_DEC_WIDTH
230 # define PRINTF_INT8_DEC_WIDTH "3"
232 # ifndef PRINTF_INTMAX_HEX_WIDTH
233 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
235 # ifndef PRINTF_INTMAX_DEC_WIDTH
236 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
240 #ifndef _PSTDINT_H_INCLUDED
241 #define _PSTDINT_H_INCLUDED
244 # define SIZE_MAX (~(size_t)0)
248 * Deduce the type assignments from limits.h under the assumption that
249 * integer sizes in bits are powers of 2, and follow the ANSI
254 # define UINT8_MAX 0xff
257 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
258 typedef unsigned char uint8_t;
259 # define UINT8_C(v) ((uint8_t) v)
261 # error "Platform not supported"
266 # define INT8_MAX 0x7f
269 # define INT8_MIN INT8_C(0x80)
272 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
273 typedef signed char int8_t;
274 # define INT8_C(v) ((int8_t) v)
276 # error "Platform not supported"
281 # define UINT16_MAX 0xffff
284 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
285 typedef unsigned int uint16_t;
286 # ifndef PRINTF_INT16_MODIFIER
287 # define PRINTF_INT16_MODIFIER ""
289 # define UINT16_C(v) ((uint16_t) (v))
290 #elif (USHRT_MAX == UINT16_MAX)
291 typedef unsigned short uint16_t;
292 # define UINT16_C(v) ((uint16_t) (v))
293 # ifndef PRINTF_INT16_MODIFIER
294 # define PRINTF_INT16_MODIFIER "h"
297 #error "Platform not supported"
302 # define INT16_MAX 0x7fff
305 # define INT16_MIN INT16_C(0x8000)
308 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
309 typedef signed int int16_t;
310 # define INT16_C(v) ((int16_t) (v))
311 # ifndef PRINTF_INT16_MODIFIER
312 # define PRINTF_INT16_MODIFIER ""
314 #elif (SHRT_MAX == INT16_MAX)
315 typedef signed short int16_t;
316 # define INT16_C(v) ((int16_t) (v))
317 # ifndef PRINTF_INT16_MODIFIER
318 # define PRINTF_INT16_MODIFIER "h"
321 #error "Platform not supported"
326 # define UINT32_MAX (0xffffffffUL)
329 #if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
330 typedef unsigned long uint32_t;
331 # define UINT32_C(v) v ## UL
332 # ifndef PRINTF_INT32_MODIFIER
333 # define PRINTF_INT32_MODIFIER "l"
335 #elif (UINT_MAX == UINT32_MAX)
336 typedef unsigned int uint32_t;
337 # ifndef PRINTF_INT32_MODIFIER
338 # define PRINTF_INT32_MODIFIER ""
340 # define UINT32_C(v) v ## U
341 #elif (USHRT_MAX == UINT32_MAX)
342 typedef unsigned short uint32_t;
343 # define UINT32_C(v) ((unsigned short) (v))
344 # ifndef PRINTF_INT32_MODIFIER
345 # define PRINTF_INT32_MODIFIER ""
348 #error "Platform not supported"
353 # define INT32_MAX (0x7fffffffL)
356 # define INT32_MIN INT32_C(0x80000000)
359 #if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
360 typedef signed long int32_t;
361 # define INT32_C(v) v ## L
362 # ifndef PRINTF_INT32_MODIFIER
363 # define PRINTF_INT32_MODIFIER "l"
365 #elif (INT_MAX == INT32_MAX)
366 typedef signed int int32_t;
367 # define INT32_C(v) v
368 # ifndef PRINTF_INT32_MODIFIER
369 # define PRINTF_INT32_MODIFIER ""
371 #elif (SHRT_MAX == INT32_MAX)
372 typedef signed short int32_t;
373 # define INT32_C(v) ((short) (v))
374 # ifndef PRINTF_INT32_MODIFIER
375 # define PRINTF_INT32_MODIFIER ""
378 #error "Platform not supported"
383 * The macro stdint_int64_defined is temporarily used to record
384 * whether or not 64 integer support is available. It must be
385 * defined for any 64 integer extensions for new platforms that are
389 #undef stdint_int64_defined
390 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
391 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
392 # define stdint_int64_defined
393 typedef long long int64_t;
394 typedef unsigned long long uint64_t;
395 # define UINT64_C(v) v ## ULL
396 # define INT64_C(v) v ## LL
397 # ifndef PRINTF_INT64_MODIFIER
398 # define PRINTF_INT64_MODIFIER "ll"
403 #if !defined (stdint_int64_defined)
404 # if defined(__GNUC__)
405 # define stdint_int64_defined
406 __extension__
typedef long long int64_t;
407 __extension__
typedef unsigned long long uint64_t;
408 # define UINT64_C(v) v ## ULL
409 # define INT64_C(v) v ## LL
410 # ifndef PRINTF_INT64_MODIFIER
411 # define PRINTF_INT64_MODIFIER "ll"
413 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
414 # define stdint_int64_defined
415 typedef long long int64_t;
416 typedef unsigned long long uint64_t;
417 # define UINT64_C(v) v ## ULL
418 # define INT64_C(v) v ## LL
419 # ifndef PRINTF_INT64_MODIFIER
420 # define PRINTF_INT64_MODIFIER "ll"
422 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
423 # define stdint_int64_defined
424 typedef __int64
int64_t;
425 typedef unsigned __int64
uint64_t;
426 # define UINT64_C(v) v ## UI64
427 # define INT64_C(v) v ## I64
428 # ifndef PRINTF_INT64_MODIFIER
429 # define PRINTF_INT64_MODIFIER "I64"
434 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
435 # define LONG_LONG_MAX INT64_C (9223372036854775807)
437 #ifndef ULONG_LONG_MAX
438 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
441 #if !defined (INT64_MAX) && defined (INT64_C)
442 # define INT64_MAX INT64_C (9223372036854775807)
444 #if !defined (INT64_MIN) && defined (INT64_C)
445 # define INT64_MIN INT64_C (-9223372036854775808)
447 #if !defined (UINT64_MAX) && defined (INT64_C)
448 # define UINT64_MAX UINT64_C (18446744073709551615)
452 * Width of hexadecimal for number field.
455 #ifndef PRINTF_INT64_HEX_WIDTH
456 # define PRINTF_INT64_HEX_WIDTH "16"
458 #ifndef PRINTF_INT32_HEX_WIDTH
459 # define PRINTF_INT32_HEX_WIDTH "8"
461 #ifndef PRINTF_INT16_HEX_WIDTH
462 # define PRINTF_INT16_HEX_WIDTH "4"
464 #ifndef PRINTF_INT8_HEX_WIDTH
465 # define PRINTF_INT8_HEX_WIDTH "2"
468 #ifndef PRINTF_INT64_DEC_WIDTH
469 # define PRINTF_INT64_DEC_WIDTH "20"
471 #ifndef PRINTF_INT32_DEC_WIDTH
472 # define PRINTF_INT32_DEC_WIDTH "10"
474 #ifndef PRINTF_INT16_DEC_WIDTH
475 # define PRINTF_INT16_DEC_WIDTH "5"
477 #ifndef PRINTF_INT8_DEC_WIDTH
478 # define PRINTF_INT8_DEC_WIDTH "3"
482 * Ok, lets not worry about 128 bit integers for now. Moore's law says
483 * we don't need to worry about that until about 2040 at which point
484 * we'll have bigger things to worry about.
487 #ifdef stdint_int64_defined
488 typedef int64_t intmax_t;
489 typedef uint64_t uintmax_t;
490 # define INTMAX_MAX INT64_MAX
491 # define INTMAX_MIN INT64_MIN
492 # define UINTMAX_MAX UINT64_MAX
493 # define UINTMAX_C(v) UINT64_C(v)
494 # define INTMAX_C(v) INT64_C(v)
495 # ifndef PRINTF_INTMAX_MODIFIER
496 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
498 # ifndef PRINTF_INTMAX_HEX_WIDTH
499 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
501 # ifndef PRINTF_INTMAX_DEC_WIDTH
502 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
505 typedef int32_t intmax_t;
506 typedef uint32_t uintmax_t;
507 # define INTMAX_MAX INT32_MAX
508 # define UINTMAX_MAX UINT32_MAX
509 # define UINTMAX_C(v) UINT32_C(v)
510 # define INTMAX_C(v) INT32_C(v)
511 # ifndef PRINTF_INTMAX_MODIFIER
512 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
514 # ifndef PRINTF_INTMAX_HEX_WIDTH
515 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
517 # ifndef PRINTF_INTMAX_DEC_WIDTH
518 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
523 * Because this file currently only supports platforms which have
524 * precise powers of 2 as bit sizes for the default integers, the
525 * least definitions are all trivial. Its possible that a future
526 * version of this file could have different definitions.
529 #ifndef stdint_least_defined
530 typedef int8_t int_least8_t;
531 typedef uint8_t uint_least8_t;
532 typedef int16_t int_least16_t;
533 typedef uint16_t uint_least16_t;
534 typedef int32_t int_least32_t;
535 typedef uint32_t uint_least32_t;
536 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
537 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
538 # define UINT_LEAST8_MAX UINT8_MAX
539 # define INT_LEAST8_MAX INT8_MAX
540 # define UINT_LEAST16_MAX UINT16_MAX
541 # define INT_LEAST16_MAX INT16_MAX
542 # define UINT_LEAST32_MAX UINT32_MAX
543 # define INT_LEAST32_MAX INT32_MAX
544 # define INT_LEAST8_MIN INT8_MIN
545 # define INT_LEAST16_MIN INT16_MIN
546 # define INT_LEAST32_MIN INT32_MIN
547 # ifdef stdint_int64_defined
548 typedef int64_t int_least64_t;
549 typedef uint64_t uint_least64_t;
550 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
551 # define UINT_LEAST64_MAX UINT64_MAX
552 # define INT_LEAST64_MAX INT64_MAX
553 # define INT_LEAST64_MIN INT64_MIN
556 #undef stdint_least_defined
559 * The ANSI C committee pretending to know or specify anything about
560 * performance is the epitome of misguided arrogance. The mandate of
561 * this file is to *ONLY* ever support that absolute minimum
562 * definition of the fast integer types, for compatibility purposes.
563 * No extensions, and no attempt to suggest what may or may not be a
564 * faster integer type will ever be made in this file. Developers are
565 * warned to stay away from these types when using this or any other
569 typedef int_least8_t int_fast8_t;
570 typedef uint_least8_t uint_fast8_t;
571 typedef int_least16_t int_fast16_t;
572 typedef uint_least16_t uint_fast16_t;
573 typedef int_least32_t int_fast32_t;
574 typedef uint_least32_t uint_fast32_t;
575 #define UINT_FAST8_MAX UINT_LEAST8_MAX
576 #define INT_FAST8_MAX INT_LEAST8_MAX
577 #define UINT_FAST16_MAX UINT_LEAST16_MAX
578 #define INT_FAST16_MAX INT_LEAST16_MAX
579 #define UINT_FAST32_MAX UINT_LEAST32_MAX
580 #define INT_FAST32_MAX INT_LEAST32_MAX
581 #define INT_FAST8_MIN IN_LEASTT8_MIN
582 #define INT_FAST16_MIN INT_LEAST16_MIN
583 #define INT_FAST32_MIN INT_LEAST32_MIN
584 #ifdef stdint_int64_defined
585 typedef int_least64_t int_fast64_t;
586 typedef uint_least64_t uint_fast64_t;
587 # define UINT_FAST64_MAX UINT_LEAST64_MAX
588 # define INT_FAST64_MAX INT_LEAST64_MAX
589 # define INT_FAST64_MIN INT_LEAST64_MIN
592 #undef stdint_int64_defined
595 * Whatever piecemeal, per compiler thing we can do about the wchar_t
599 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
605 # define WCHAR_MAX ((wchar_t)-1)
610 * Whatever piecemeal, per compiler/platform thing we can do about the
611 * (u)intptr_t types and limits.
614 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
615 # define STDINT_H_UINTPTR_T_DEFINED
618 #ifndef STDINT_H_UINTPTR_T_DEFINED
619 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
620 # define stdint_intptr_bits 64
621 # elif defined (__WATCOMC__) || defined (__TURBOC__)
622 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
623 # define stdint_intptr_bits 16
625 # define stdint_intptr_bits 32
627 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
628 # define stdint_intptr_bits 32
629 # elif defined (__INTEL_COMPILER)
630 /* TODO -- what will Intel do about x86-64? */
633 # ifdef stdint_intptr_bits
634 # define stdint_intptr_glue3_i(a,b,c) a##b##c
635 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
636 # ifndef PRINTF_INTPTR_MODIFIER
637 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
640 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
643 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
646 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
649 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
652 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
655 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
658 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
660 typedef stdint_intptr_glue3(uint
,stdint_intptr_bits
,_t
) uintptr_t;
661 typedef stdint_intptr_glue3( int,stdint_intptr_bits
,_t
) intptr_t;
663 /* TODO -- This following is likely wrong for some platforms, and does
664 nothing for the definition of uintptr_t. */
665 typedef ptrdiff_t intptr_t;
667 # define STDINT_H_UINTPTR_T_DEFINED
671 * Assumes sig_atomic_t is signed and we have a 2s complement machine.
674 #ifndef SIG_ATOMIC_MAX
675 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)