| 1 | /*
|
|---|
| 2 | * The header stdint.h declares sets of integer types having specified widths, and
|
|---|
| 3 | * defines corresponding sets of macros
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #ifndef _STDINT_
|
|---|
| 7 | #define _STDINT_
|
|---|
| 8 |
|
|---|
| 9 | typedef signed char int8_t;
|
|---|
| 10 | typedef int int16_t;
|
|---|
| 11 | typedef long int int32_t;
|
|---|
| 12 | typedef long long int int64_t;
|
|---|
| 13 |
|
|---|
| 14 | typedef unsigned char uint8_t;
|
|---|
| 15 | typedef unsigned int uint16_t;
|
|---|
| 16 | typedef unsigned long int uint32_t;
|
|---|
| 17 | typedef unsigned long long int uint64_t;
|
|---|
| 18 |
|
|---|
| 19 | /* Small types. */
|
|---|
| 20 |
|
|---|
| 21 | /* Signed. */
|
|---|
| 22 | typedef signed char int_least8_t;
|
|---|
| 23 | typedef int int_least16_t;
|
|---|
| 24 | typedef long int int_least32_t;
|
|---|
| 25 | typedef long long int int_least64_t;
|
|---|
| 26 |
|
|---|
| 27 | /* Unsigned. */
|
|---|
| 28 | typedef unsigned char uint_least8_t;
|
|---|
| 29 | typedef unsigned int uint_least16_t;
|
|---|
| 30 | typedef unsigned long int uint_least32_t;
|
|---|
| 31 | typedef unsigned long long int uint_least64_t;
|
|---|
| 32 |
|
|---|
| 33 | /* Fast types. */
|
|---|
| 34 |
|
|---|
| 35 | /* Signed. */
|
|---|
| 36 | typedef signed char int_fast8_t;
|
|---|
| 37 | typedef int int_fast16_t;
|
|---|
| 38 | typedef long int int_fast32_t;
|
|---|
| 39 | typedef long long int int_fast64_t;
|
|---|
| 40 |
|
|---|
| 41 | /* Unsigned. */
|
|---|
| 42 | typedef unsigned char uint_fast8_t;
|
|---|
| 43 | typedef unsigned int uint_fast16_t;
|
|---|
| 44 | typedef unsigned long int uint_fast32_t;
|
|---|
| 45 | typedef unsigned long long int uint_fast64_t;
|
|---|
| 46 |
|
|---|
| 47 | /* Largest integral types. */
|
|---|
| 48 | typedef long long int intmax_t;
|
|---|
| 49 | typedef unsigned long long int uintmax_t;
|
|---|
| 50 |
|
|---|
| 51 | typedef long int intptr_t;
|
|---|
| 52 | typedef unsigned long int uintptr_t;
|
|---|
| 53 |
|
|---|
| 54 | #if (! defined(__cplusplus)) || defined(__STDC_LIMIT_MACROS)
|
|---|
| 55 |
|
|---|
| 56 | #define INT8_MIN (-127-1)
|
|---|
| 57 | #define INT16_MIN (-32767-1)
|
|---|
| 58 | #define INT32_MIN (-2147483647-1)
|
|---|
| 59 | #define INT64_MIN (-9223372036854775807LL-1LL)
|
|---|
| 60 |
|
|---|
| 61 | #define INT8_MAX +127
|
|---|
| 62 | #define INT16_MAX +32767
|
|---|
| 63 | #define INT32_MAX +2147483647
|
|---|
| 64 | #define INT64_MAX +9223372036854775807LL
|
|---|
| 65 |
|
|---|
| 66 | #define UINT8_MAX 255
|
|---|
| 67 | #define UINT16_MAX 65535
|
|---|
| 68 | #define UINT32_MAX 4294967295U
|
|---|
| 69 | #define UINT64_MAX 18446744073709551615ULL
|
|---|
| 70 |
|
|---|
| 71 | #define INT_LEAST8_MIN INT8_MIN
|
|---|
| 72 | #define INT_LEAST16_MIN INT16_MIN
|
|---|
| 73 | #define INT_LEAST32_MIN INT32_MIN
|
|---|
| 74 | #define INT_LEAST64_MIN INT64_MIN
|
|---|
| 75 |
|
|---|
| 76 | #define INT_LEAST8_MAX INT8_MAX
|
|---|
| 77 | #define INT_LEAST16_MAX INT16_MAX
|
|---|
| 78 | #define INT_LEAST32_MAX INT32_MAX
|
|---|
| 79 | #define INT_LEAST64_MAX INT64_MAX
|
|---|
| 80 |
|
|---|
| 81 | #define UINT_LEAST8_MAX UINT8_MAX
|
|---|
| 82 | #define UINT_LEAST16_MAX UINT16_MAX
|
|---|
| 83 | #define UINT_LEAST32_MAX UINT32_MAX
|
|---|
| 84 | #define UINT_LEAST64_MAX UINT64_MAX
|
|---|
| 85 |
|
|---|
| 86 | #define INT_FAST8_MIN INT8_MIN
|
|---|
| 87 | #define INT_FAST16_MIN INT16_MIN
|
|---|
| 88 | #define INT_FAST32_MIN INT32_MIN
|
|---|
| 89 | #define INT_FAST64_MIN INT64_MIN
|
|---|
| 90 |
|
|---|
| 91 | #define INT_FAST8_MAX INT8_MAX
|
|---|
| 92 | #define INT_FAST16_MAX INT16_MAX
|
|---|
| 93 | #define INT_FAST32_MAX INT32_MAX
|
|---|
| 94 | #define INT_FAST64_MAX INT64_MAX
|
|---|
| 95 |
|
|---|
| 96 | #define UINT_FAST8_MAX UINT8_MAX
|
|---|
| 97 | #define UINT_FAST16_MAX UINT16_MAX
|
|---|
| 98 | #define UINT_FAST32_MAX UINT32_MAX
|
|---|
| 99 | #define UINT_FAST64_MAX UINT64_MAX
|
|---|
| 100 |
|
|---|
| 101 | #if defined(__LP64__)
|
|---|
| 102 | #define INTPTR_MIN INT64_MIN
|
|---|
| 103 | #define INTPTR_MAX INT64_MAX
|
|---|
| 104 | #define UINTPTR_MAX UINT64_MAX
|
|---|
| 105 | #else
|
|---|
| 106 | #define INTPTR_MIN INT32_MIN
|
|---|
| 107 | #define INTPTR_MAX INT32_MAX
|
|---|
| 108 | #define UINTPTR_MAX UINT32_MAX
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | #define INTMAX_MIN INT64_MIN
|
|---|
| 112 | #define INTMAX_MAX INT64_MAX
|
|---|
| 113 |
|
|---|
| 114 | #define UINTMAX_MAX UINT64_MAX
|
|---|
| 115 |
|
|---|
| 116 | #if defined(__LP64__)
|
|---|
| 117 | #define PTRDIFF_MIN INT64_MIN
|
|---|
| 118 | #define PTRDIFF_MAX INT64_MAX
|
|---|
| 119 | #else
|
|---|
| 120 | #define PTRDIFF_MIN INT32_MIN
|
|---|
| 121 | #define PTRDIFF_MAX INT32_MAX
|
|---|
| 122 | #endif
|
|---|
| 123 |
|
|---|
| 124 | #define SIZE_MAX UINT32_MAX
|
|---|
| 125 |
|
|---|
| 126 | #define WCHAR_MAX INT32_MAX
|
|---|
| 127 |
|
|---|
| 128 | #endif
|
|---|
| 129 |
|
|---|
| 130 | #if (! defined(__cplusplus)) || defined(__STDC_CONSTANT_MACROS)
|
|---|
| 131 |
|
|---|
| 132 | #define INT8_C(v) ((int8_t)v)
|
|---|
| 133 | #define INT16_C(v) ((int16_t)v)
|
|---|
| 134 | #define INT32_C(v) (v ## L)
|
|---|
| 135 | #define INT64_C(v) (v ## LL)
|
|---|
| 136 |
|
|---|
| 137 | #define UINT8_C(v) ((uint8_t)v)
|
|---|
| 138 | #define UINT16_C(v) ((uint16_t)v)
|
|---|
| 139 | #define UINT32_C(v) (v ## UL)
|
|---|
| 140 | #define UINT64_C(v) (v ## ULL)
|
|---|
| 141 |
|
|---|
| 142 | #define INTMAX_C(v) (v ## LL)
|
|---|
| 143 | #define UINTMAX_C(v) (v ## ULL)
|
|---|
| 144 |
|
|---|
| 145 | #endif
|
|---|
| 146 |
|
|---|
| 147 | #endif
|
|---|