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