00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 #include <stddef.h>
00185 #include <limits.h>
00186 #include <signal.h>
00187
00188
00189
00190
00191
00192
00193 #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(__FreeBSD__)
00194 #include <stdint.h>
00195 #define _PSTDINT_H_INCLUDED
00196 # ifndef PRINTF_INT64_MODIFIER
00197 # define PRINTF_INT64_MODIFIER "ll"
00198 # endif
00199 # ifndef PRINTF_INT32_MODIFIER
00200 # define PRINTF_INT32_MODIFIER "l"
00201 # endif
00202 # ifndef PRINTF_INT16_MODIFIER
00203 # define PRINTF_INT16_MODIFIER "h"
00204 # endif
00205 # ifndef PRINTF_INTMAX_MODIFIER
00206 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00207 # endif
00208 # ifndef PRINTF_INT64_HEX_WIDTH
00209 # define PRINTF_INT64_HEX_WIDTH "16"
00210 # endif
00211 # ifndef PRINTF_INT32_HEX_WIDTH
00212 # define PRINTF_INT32_HEX_WIDTH "8"
00213 # endif
00214 # ifndef PRINTF_INT16_HEX_WIDTH
00215 # define PRINTF_INT16_HEX_WIDTH "4"
00216 # endif
00217 # ifndef PRINTF_INT8_HEX_WIDTH
00218 # define PRINTF_INT8_HEX_WIDTH "2"
00219 # endif
00220 # ifndef PRINTF_INT64_DEC_WIDTH
00221 # define PRINTF_INT64_DEC_WIDTH "20"
00222 # endif
00223 # ifndef PRINTF_INT32_DEC_WIDTH
00224 # define PRINTF_INT32_DEC_WIDTH "10"
00225 # endif
00226 # ifndef PRINTF_INT16_DEC_WIDTH
00227 # define PRINTF_INT16_DEC_WIDTH "5"
00228 # endif
00229 # ifndef PRINTF_INT8_DEC_WIDTH
00230 # define PRINTF_INT8_DEC_WIDTH "3"
00231 # endif
00232 # ifndef PRINTF_INTMAX_HEX_WIDTH
00233 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00234 # endif
00235 # ifndef PRINTF_INTMAX_DEC_WIDTH
00236 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00237 # endif
00238
00239
00240
00241
00242
00243
00244 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
00245 # if !defined (INT64_C)
00246 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
00247 # endif
00248 # if !defined (UINT64_C)
00249 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
00250 # endif
00251 # if !defined (INT32_C)
00252 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
00253 # endif
00254 # if !defined (UINT32_C)
00255 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
00256 # endif
00257 # if !defined (INT16_C)
00258 # define INT16_C(x) (x)
00259 # endif
00260 # if !defined (UINT16_C)
00261 # define UINT16_C(x) (x)
00262 # endif
00263 # if !defined (INT8_C)
00264 # define INT8_C(x) (x)
00265 # endif
00266 # if !defined (UINT8_C)
00267 # define UINT8_C(x) (x)
00268 # endif
00269 # if !defined (UINT64_MAX)
00270 # define UINT64_MAX 18446744073709551615ULL
00271 # endif
00272 # if !defined (INT64_MAX)
00273 # define INT64_MAX 9223372036854775807LL
00274 # endif
00275 # if !defined (UINT32_MAX)
00276 # define UINT32_MAX 4294967295UL
00277 # endif
00278 # if !defined (INT32_MAX)
00279 # define INT32_MAX 2147483647L
00280 # endif
00281 # if !defined (INTMAX_MAX)
00282 # define INTMAX_MAX INT64_MAX
00283 # endif
00284 # if !defined (INTMAX_MIN)
00285 # define INTMAX_MIN INT64_MIN
00286 # endif
00287 # endif
00288 #endif
00289
00290 #ifndef _PSTDINT_H_INCLUDED
00291 #define _PSTDINT_H_INCLUDED
00292
00293 #ifndef SIZE_MAX
00294 # define SIZE_MAX (~(size_t)0)
00295 #endif
00296
00297
00298
00299
00300
00301
00302
00303 #ifndef UINT8_MAX
00304 # define UINT8_MAX 0xff
00305 #endif
00306 #ifndef uint8_t
00307 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
00308 typedef unsigned char uint8_t;
00309 # define UINT8_C(v) ((uint8_t) v)
00310 # else
00311 # error "Platform not supported"
00312 # endif
00313 #endif
00314
00315 #ifndef INT8_MAX
00316 # define INT8_MAX 0x7f
00317 #endif
00318 #ifndef INT8_MIN
00319 # define INT8_MIN INT8_C(0x80)
00320 #endif
00321 #ifndef int8_t
00322 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
00323 typedef signed char int8_t;
00324 # define INT8_C(v) ((int8_t) v)
00325 # else
00326 # error "Platform not supported"
00327 # endif
00328 #endif
00329
00330 #ifndef UINT16_MAX
00331 # define UINT16_MAX 0xffff
00332 #endif
00333 #ifndef uint16_t
00334 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
00335 typedef unsigned int uint16_t;
00336 # ifndef PRINTF_INT16_MODIFIER
00337 # define PRINTF_INT16_MODIFIER ""
00338 # endif
00339 # define UINT16_C(v) ((uint16_t) (v))
00340 #elif (USHRT_MAX == UINT16_MAX)
00341 typedef unsigned short uint16_t;
00342 # define UINT16_C(v) ((uint16_t) (v))
00343 # ifndef PRINTF_INT16_MODIFIER
00344 # define PRINTF_INT16_MODIFIER "h"
00345 # endif
00346 #else
00347 #error "Platform not supported"
00348 #endif
00349 #endif
00350
00351 #ifndef INT16_MAX
00352 # define INT16_MAX 0x7fff
00353 #endif
00354 #ifndef INT16_MIN
00355 # define INT16_MIN INT16_C(0x8000)
00356 #endif
00357 #ifndef int16_t
00358 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
00359 typedef signed int int16_t;
00360 # define INT16_C(v) ((int16_t) (v))
00361 # ifndef PRINTF_INT16_MODIFIER
00362 # define PRINTF_INT16_MODIFIER ""
00363 # endif
00364 #elif (SHRT_MAX == INT16_MAX)
00365 typedef signed short int16_t;
00366 # define INT16_C(v) ((int16_t) (v))
00367 # ifndef PRINTF_INT16_MODIFIER
00368 # define PRINTF_INT16_MODIFIER "h"
00369 # endif
00370 #else
00371 #error "Platform not supported"
00372 #endif
00373 #endif
00374
00375 #ifndef UINT32_MAX
00376 # define UINT32_MAX (0xffffffffUL)
00377 #endif
00378 #ifndef uint32_t
00379 #if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
00380 typedef unsigned long uint32_t;
00381 # define UINT32_C(v) v ## UL
00382 # ifndef PRINTF_INT32_MODIFIER
00383 # define PRINTF_INT32_MODIFIER "l"
00384 # endif
00385 #elif (UINT_MAX == UINT32_MAX)
00386 typedef unsigned int uint32_t;
00387 # ifndef PRINTF_INT32_MODIFIER
00388 # define PRINTF_INT32_MODIFIER ""
00389 # endif
00390 # define UINT32_C(v) v ## U
00391 #elif (USHRT_MAX == UINT32_MAX)
00392 typedef unsigned short uint32_t;
00393 # define UINT32_C(v) ((unsigned short) (v))
00394 # ifndef PRINTF_INT32_MODIFIER
00395 # define PRINTF_INT32_MODIFIER ""
00396 # endif
00397 #else
00398 #error "Platform not supported"
00399 #endif
00400 #endif
00401
00402 #ifndef INT32_MAX
00403 # define INT32_MAX (0x7fffffffL)
00404 #endif
00405 #ifndef INT32_MIN
00406 # define INT32_MIN INT32_C(0x80000000)
00407 #endif
00408 #ifndef int32_t
00409 #if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
00410 typedef signed long int32_t;
00411 # define INT32_C(v) v ## L
00412 # ifndef PRINTF_INT32_MODIFIER
00413 # define PRINTF_INT32_MODIFIER "l"
00414 # endif
00415 #elif (INT_MAX == INT32_MAX)
00416 typedef signed int int32_t;
00417 # define INT32_C(v) v
00418 # ifndef PRINTF_INT32_MODIFIER
00419 # define PRINTF_INT32_MODIFIER ""
00420 # endif
00421 #elif (SHRT_MAX == INT32_MAX)
00422 typedef signed short int32_t;
00423 # define INT32_C(v) ((short) (v))
00424 # ifndef PRINTF_INT32_MODIFIER
00425 # define PRINTF_INT32_MODIFIER ""
00426 # endif
00427 #else
00428 #error "Platform not supported"
00429 #endif
00430 #endif
00431
00432
00433
00434
00435
00436
00437
00438
00439 #undef stdint_int64_defined
00440 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
00441 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
00442 # define stdint_int64_defined
00443 typedef long long int64_t;
00444 typedef unsigned long long uint64_t;
00445 # define UINT64_C(v) v ## ULL
00446 # define INT64_C(v) v ## LL
00447 # ifndef PRINTF_INT64_MODIFIER
00448 # define PRINTF_INT64_MODIFIER "ll"
00449 # endif
00450 # endif
00451 #endif
00452
00453 #if !defined (stdint_int64_defined)
00454 # if defined(__GNUC__)
00455 # define stdint_int64_defined
00456 __extension__ typedef long long int64_t;
00457 __extension__ typedef unsigned long long uint64_t;
00458 # define UINT64_C(v) v ## ULL
00459 # define INT64_C(v) v ## LL
00460 # ifndef PRINTF_INT64_MODIFIER
00461 # define PRINTF_INT64_MODIFIER "ll"
00462 # endif
00463 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
00464 # define stdint_int64_defined
00465 typedef long long int64_t;
00466 typedef unsigned long long uint64_t;
00467 # define UINT64_C(v) v ## ULL
00468 # define INT64_C(v) v ## LL
00469 # ifndef PRINTF_INT64_MODIFIER
00470 # define PRINTF_INT64_MODIFIER "ll"
00471 # endif
00472 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
00473 # define stdint_int64_defined
00474 typedef __int64 int64_t;
00475 typedef unsigned __int64 uint64_t;
00476 # define UINT64_C(v) v ## UI64
00477 # define INT64_C(v) v ## I64
00478 # ifndef PRINTF_INT64_MODIFIER
00479 # define PRINTF_INT64_MODIFIER "I64"
00480 # endif
00481 # endif
00482 #endif
00483
00484 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
00485 # define LONG_LONG_MAX INT64_C (9223372036854775807)
00486 #endif
00487 #ifndef ULONG_LONG_MAX
00488 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
00489 #endif
00490
00491 #if !defined (INT64_MAX) && defined (INT64_C)
00492 # define INT64_MAX INT64_C (9223372036854775807)
00493 #endif
00494 #if !defined (INT64_MIN) && defined (INT64_C)
00495 # define INT64_MIN INT64_C (-9223372036854775808)
00496 #endif
00497 #if !defined (UINT64_MAX) && defined (INT64_C)
00498 # define UINT64_MAX UINT64_C (18446744073709551615)
00499 #endif
00500
00501
00502
00503
00504
00505 #ifndef PRINTF_INT64_HEX_WIDTH
00506 # define PRINTF_INT64_HEX_WIDTH "16"
00507 #endif
00508 #ifndef PRINTF_INT32_HEX_WIDTH
00509 # define PRINTF_INT32_HEX_WIDTH "8"
00510 #endif
00511 #ifndef PRINTF_INT16_HEX_WIDTH
00512 # define PRINTF_INT16_HEX_WIDTH "4"
00513 #endif
00514 #ifndef PRINTF_INT8_HEX_WIDTH
00515 # define PRINTF_INT8_HEX_WIDTH "2"
00516 #endif
00517
00518 #ifndef PRINTF_INT64_DEC_WIDTH
00519 # define PRINTF_INT64_DEC_WIDTH "20"
00520 #endif
00521 #ifndef PRINTF_INT32_DEC_WIDTH
00522 # define PRINTF_INT32_DEC_WIDTH "10"
00523 #endif
00524 #ifndef PRINTF_INT16_DEC_WIDTH
00525 # define PRINTF_INT16_DEC_WIDTH "5"
00526 #endif
00527 #ifndef PRINTF_INT8_DEC_WIDTH
00528 # define PRINTF_INT8_DEC_WIDTH "3"
00529 #endif
00530
00531
00532
00533
00534
00535
00536
00537 #ifdef stdint_int64_defined
00538 typedef int64_t intmax_t;
00539 typedef uint64_t uintmax_t;
00540 # define INTMAX_MAX INT64_MAX
00541 # define INTMAX_MIN INT64_MIN
00542 # define UINTMAX_MAX UINT64_MAX
00543 # define UINTMAX_C(v) UINT64_C(v)
00544 # define INTMAX_C(v) INT64_C(v)
00545 # ifndef PRINTF_INTMAX_MODIFIER
00546 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00547 # endif
00548 # ifndef PRINTF_INTMAX_HEX_WIDTH
00549 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00550 # endif
00551 # ifndef PRINTF_INTMAX_DEC_WIDTH
00552 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00553 # endif
00554 #else
00555 typedef int32_t intmax_t;
00556 typedef uint32_t uintmax_t;
00557 # define INTMAX_MAX INT32_MAX
00558 # define UINTMAX_MAX UINT32_MAX
00559 # define UINTMAX_C(v) UINT32_C(v)
00560 # define INTMAX_C(v) INT32_C(v)
00561 # ifndef PRINTF_INTMAX_MODIFIER
00562 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
00563 # endif
00564 # ifndef PRINTF_INTMAX_HEX_WIDTH
00565 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
00566 # endif
00567 # ifndef PRINTF_INTMAX_DEC_WIDTH
00568 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
00569 # endif
00570 #endif
00571
00572
00573
00574
00575
00576
00577
00578
00579 #ifndef stdint_least_defined
00580 typedef int8_t int_least8_t;
00581 typedef uint8_t uint_least8_t;
00582 typedef int16_t int_least16_t;
00583 typedef uint16_t uint_least16_t;
00584 typedef int32_t int_least32_t;
00585 typedef uint32_t uint_least32_t;
00586 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
00587 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
00588 # define UINT_LEAST8_MAX UINT8_MAX
00589 # define INT_LEAST8_MAX INT8_MAX
00590 # define UINT_LEAST16_MAX UINT16_MAX
00591 # define INT_LEAST16_MAX INT16_MAX
00592 # define UINT_LEAST32_MAX UINT32_MAX
00593 # define INT_LEAST32_MAX INT32_MAX
00594 # define INT_LEAST8_MIN INT8_MIN
00595 # define INT_LEAST16_MIN INT16_MIN
00596 # define INT_LEAST32_MIN INT32_MIN
00597 # ifdef stdint_int64_defined
00598 typedef int64_t int_least64_t;
00599 typedef uint64_t uint_least64_t;
00600 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
00601 # define UINT_LEAST64_MAX UINT64_MAX
00602 # define INT_LEAST64_MAX INT64_MAX
00603 # define INT_LEAST64_MIN INT64_MIN
00604 # endif
00605 #endif
00606 #undef stdint_least_defined
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619 typedef int_least8_t int_fast8_t;
00620 typedef uint_least8_t uint_fast8_t;
00621 typedef int_least16_t int_fast16_t;
00622 typedef uint_least16_t uint_fast16_t;
00623 typedef int_least32_t int_fast32_t;
00624 typedef uint_least32_t uint_fast32_t;
00625 #define UINT_FAST8_MAX UINT_LEAST8_MAX
00626 #define INT_FAST8_MAX INT_LEAST8_MAX
00627 #define UINT_FAST16_MAX UINT_LEAST16_MAX
00628 #define INT_FAST16_MAX INT_LEAST16_MAX
00629 #define UINT_FAST32_MAX UINT_LEAST32_MAX
00630 #define INT_FAST32_MAX INT_LEAST32_MAX
00631 #define INT_FAST8_MIN INT_LEAST8_MIN
00632 #define INT_FAST16_MIN INT_LEAST16_MIN
00633 #define INT_FAST32_MIN INT_LEAST32_MIN
00634 #ifdef stdint_int64_defined
00635 typedef int_least64_t int_fast64_t;
00636 typedef uint_least64_t uint_fast64_t;
00637 # define UINT_FAST64_MAX UINT_LEAST64_MAX
00638 # define INT_FAST64_MAX INT_LEAST64_MAX
00639 # define INT_FAST64_MIN INT_LEAST64_MIN
00640 #endif
00641
00642 #undef stdint_int64_defined
00643
00644
00645
00646
00647
00648
00649 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
00650 # include <wchar.h>
00651 # ifndef WCHAR_MIN
00652 # define WCHAR_MIN 0
00653 # endif
00654 # ifndef WCHAR_MAX
00655 # define WCHAR_MAX ((wchar_t)-1)
00656 # endif
00657 #endif
00658
00659
00660
00661
00662
00663
00664 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
00665 # define STDINT_H_UINTPTR_T_DEFINED
00666 #endif
00667
00668 #ifndef STDINT_H_UINTPTR_T_DEFINED
00669 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
00670 # define stdint_intptr_bits 64
00671 # elif defined (__WATCOMC__) || defined (__TURBOC__)
00672 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
00673 # define stdint_intptr_bits 16
00674 # else
00675 # define stdint_intptr_bits 32
00676 # endif
00677 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
00678 # define stdint_intptr_bits 32
00679 # elif defined (__INTEL_COMPILER)
00680
00681 # endif
00682
00683 # ifdef stdint_intptr_bits
00684 # define stdint_intptr_glue3_i(a,b,c) a##b##c
00685 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
00686 # ifndef PRINTF_INTPTR_MODIFIER
00687 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
00688 # endif
00689 # ifndef PTRDIFF_MAX
00690 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00691 # endif
00692 # ifndef PTRDIFF_MIN
00693 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00694 # endif
00695 # ifndef UINTPTR_MAX
00696 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
00697 # endif
00698 # ifndef INTPTR_MAX
00699 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00700 # endif
00701 # ifndef INTPTR_MIN
00702 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00703 # endif
00704 # ifndef INTPTR_C
00705 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
00706 # endif
00707 # ifndef UINTPTR_C
00708 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
00709 # endif
00710 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
00711 typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
00712 # else
00713
00714
00715 typedef ptrdiff_t intptr_t;
00716 # endif
00717 # define STDINT_H_UINTPTR_T_DEFINED
00718 #endif
00719
00720
00721
00722
00723
00724 #ifndef SIG_ATOMIC_MAX
00725 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
00726 #endif
00727
00728 #endif
00729
00730 #if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
00731
00732
00733
00734
00735
00736
00737 #include <stdlib.h>
00738 #include <stdio.h>
00739 #include <string.h>
00740
00741 #define glue3_aux(x,y,z) x ## y ## z
00742 #define glue3(x,y,z) glue3_aux(x,y,z)
00743
00744 #define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
00745 #define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
00746
00747 #define DECL(us,bits) glue3(DECL,us,) (bits)
00748
00749 #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)
00750
00751 int main () {
00752 DECL(I,8)
00753 DECL(U,8)
00754 DECL(I,16)
00755 DECL(U,16)
00756 DECL(I,32)
00757 DECL(U,32)
00758 #ifdef INT64_MAX
00759 DECL(I,64)
00760 DECL(U,64)
00761 #endif
00762 intmax_t imax = INTMAX_C(0);
00763 uintmax_t umax = UINTMAX_C(0);
00764 char str0[256], str1[256];
00765
00766 sprintf (str0, "%d %x\n", 0, ~0);
00767
00768 sprintf (str1, "%d %x\n", i8, ~0);
00769 if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
00770 sprintf (str1, "%u %x\n", u8, ~0);
00771 if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
00772 sprintf (str1, "%d %x\n", i16, ~0);
00773 if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
00774 sprintf (str1, "%u %x\n", u16, ~0);
00775 if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
00776 sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
00777 if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
00778 sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
00779 if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
00780 #ifdef INT64_MAX
00781 sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
00782 if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
00783 #endif
00784 sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
00785 if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
00786 sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
00787 if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
00788
00789 TESTUMAX(8);
00790 TESTUMAX(16);
00791 TESTUMAX(32);
00792 #ifdef INT64_MAX
00793 TESTUMAX(64);
00794 #endif
00795
00796 return EXIT_SUCCESS;
00797 }
00798
00799 #endif