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 #ifndef __STDINT_H_
00040 #define __STDINT_H_
00041
00051
00052
00053
00054 #if __INT_MAX__ == 127
00055 # define __USING_MINT8 1
00056 #else
00057 # define __USING_MINT8 0
00058 #endif
00059
00060
00061
00062 #if defined(__DOXYGEN__)
00063
00064
00065
00070
00074 typedef signed char int8_t;
00075
00079 typedef unsigned char uint8_t;
00080
00084 typedef signed int int16_t;
00085
00089 typedef unsigned int uint16_t;
00090
00094 typedef signed long int int32_t;
00095
00099 typedef unsigned long int uint32_t;
00100
00106 typedef signed long long int int64_t;
00107
00113 typedef unsigned long long int uint64_t;
00114
00117 #else
00118
00119
00120
00121 typedef int int8_t __attribute__((__mode__(__QI__)));
00122 typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
00123 typedef int int16_t __attribute__ ((__mode__ (__HI__)));
00124 typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
00125 typedef int int32_t __attribute__ ((__mode__ (__SI__)));
00126 typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
00127 #if !__USING_MINT8
00128 typedef int int64_t __attribute__((__mode__(__DI__)));
00129 typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
00130 #endif
00131
00132 #endif
00133
00138
00142 typedef int16_t intptr_t;
00143
00147 typedef uint16_t uintptr_t;
00148
00155
00159 typedef int8_t int_least8_t;
00160
00164 typedef uint8_t uint_least8_t;
00165
00169 typedef int16_t int_least16_t;
00170
00174 typedef uint16_t uint_least16_t;
00175
00179 typedef int32_t int_least32_t;
00180
00184 typedef uint32_t uint_least32_t;
00185
00186 #if !__USING_MINT8 || defined(__DOXYGEN__)
00187
00192 typedef int64_t int_least64_t;
00193
00199 typedef uint64_t uint_least64_t;
00200 #endif
00201
00209
00213 typedef int8_t int_fast8_t;
00214
00218 typedef uint8_t uint_fast8_t;
00219
00223 typedef int16_t int_fast16_t;
00224
00228 typedef uint16_t uint_fast16_t;
00229
00233 typedef int32_t int_fast32_t;
00234
00238 typedef uint32_t uint_fast32_t;
00239
00240 #if !__USING_MINT8 || defined(__DOXYGEN__)
00241
00246 typedef int64_t int_fast64_t;
00247
00253 typedef uint64_t uint_fast64_t;
00254 #endif
00255
00264
00265 #if __USING_MINT8
00266 typedef int32_t intmax_t;
00267
00268 typedef uint32_t uintmax_t;
00269 #else
00270
00273 typedef int64_t intmax_t;
00274
00278 typedef uint64_t uintmax_t;
00279 #endif
00280
00283
00284 #ifndef __CONCAT
00285 #define __CONCATenate(left, right) left ## right
00286 #define __CONCAT(left, right) __CONCATenate(left, right)
00287 #endif
00288
00289 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
00290
00296
00300 #define INT8_MAX 0x7f
00301
00305 #define INT8_MIN (-INT8_MAX - 1)
00306
00310 #define UINT8_MAX (__CONCAT(INT8_MAX, U) * 2U + 1U)
00311
00312 #if __USING_MINT8
00313
00314 #define INT16_MAX 0x7fffL
00315 #define INT16_MIN (-INT16_MAX - 1L)
00316 #define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2UL + 1UL)
00317
00318 #define INT32_MAX 0x7fffffffLL
00319 #define INT32_MIN (-INT32_MAX - 1LL)
00320 #define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2ULL + 1ULL)
00321
00322 #else
00323
00327 #define INT16_MAX 0x7fff
00328
00332 #define INT16_MIN (-INT16_MAX - 1)
00333
00337 #define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2U + 1U)
00338
00342 #define INT32_MAX 0x7fffffffL
00343
00347 #define INT32_MIN (-INT32_MAX - 1L)
00348
00352 #define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2UL + 1UL)
00353
00354 #endif
00355
00359 #define INT64_MAX 0x7fffffffffffffffLL
00360
00364 #define INT64_MIN (-INT64_MAX - 1LL)
00365
00369 #define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
00370
00375
00379 #define INT_LEAST8_MAX INT8_MAX
00380
00384 #define INT_LEAST8_MIN INT8_MIN
00385
00389 #define UINT_LEAST8_MAX UINT8_MAX
00390
00394 #define INT_LEAST16_MAX INT16_MAX
00395
00399 #define INT_LEAST16_MIN INT16_MIN
00400
00404 #define UINT_LEAST16_MAX UINT16_MAX
00405
00409 #define INT_LEAST32_MAX INT32_MAX
00410
00414 #define INT_LEAST32_MIN INT32_MIN
00415
00419 #define UINT_LEAST32_MAX UINT32_MAX
00420
00424 #define INT_LEAST64_MAX INT64_MAX
00425
00429 #define INT_LEAST64_MIN INT64_MIN
00430
00434 #define UINT_LEAST64_MAX UINT64_MAX
00435
00441
00445 #define INT_FAST8_MAX INT8_MAX
00446
00450 #define INT_FAST8_MIN INT8_MIN
00451
00455 #define UINT_FAST8_MAX UINT8_MAX
00456
00460 #define INT_FAST16_MAX INT16_MAX
00461
00465 #define INT_FAST16_MIN INT16_MIN
00466
00470 #define UINT_FAST16_MAX UINT16_MAX
00471
00475 #define INT_FAST32_MAX INT32_MAX
00476
00480 #define INT_FAST32_MIN INT32_MIN
00481
00485 #define UINT_FAST32_MAX UINT32_MAX
00486
00490 #define INT_FAST64_MAX INT64_MAX
00491
00495 #define INT_FAST64_MIN INT64_MIN
00496
00500 #define UINT_FAST64_MAX UINT64_MAX
00501
00507
00511 #define INTPTR_MAX INT16_MAX
00512
00516 #define INTPTR_MIN INT16_MIN
00517
00521 #define UINTPTR_MAX UINT16_MAX
00522
00528
00532 #define INTMAX_MAX INT64_MAX
00533
00537 #define INTMAX_MIN INT64_MIN
00538
00542 #define UINTMAX_MAX UINT64_MAX
00543
00551
00555 #define PTRDIFF_MAX INT16_MAX
00556
00560 #define PTRDIFF_MIN INT16_MIN
00561
00562
00563
00564
00565
00569 #define SIG_ATOMIC_MAX INT8_MAX
00570
00574 #define SIG_ATOMIC_MIN INT8_MIN
00575
00576
00580 #define SIZE_MAX (__CONCAT(INT16_MAX, U))
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595 #endif
00596
00597 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
00598
00609 #define INT8_C(value) ((int8_t) value)
00610
00614 #define UINT8_C(value) ((uint8_t) __CONCAT(value, U))
00615
00616 #if __USING_MINT8
00617
00618 #define INT16_C(value) __CONCAT(value, L)
00619 #define UINT16_C(value) __CONCAT(value, UL)
00620
00621 #define INT32_C(value) ((int32_t) __CONCAT(value, LL))
00622 #define UINT32_C(value) ((uint32_t) __CONCAT(value, ULL))
00623
00624 #else
00625
00629 #define INT16_C(value) value
00630
00634 #define UINT16_C(value) __CONCAT(value, U)
00635
00639 #define INT32_C(value) __CONCAT(value, L)
00640
00644 #define UINT32_C(value) __CONCAT(value, UL)
00645
00646 #endif
00647
00651 #define INT64_C(value) __CONCAT(value, LL)
00652
00656 #define UINT64_C(value) __CONCAT(value, ULL)
00657
00661 #define INTMAX_C(value) __CONCAT(value, LL)
00662
00666 #define UINTMAX_C(value) __CONCAT(value, ULL)
00667
00670 #endif
00671
00672
00673 #endif