1 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C 9X: 7.4 Integer types <stdint.h>
27 #define __need_wchar_t
30 /* Exact integral types. */
34 /* There is some amount of overlap with <sys/types.h> as known by inet code */
35 #ifndef __int8_t_defined
36 # define __int8_t_defined
37 typedef signed char int8_t;
38 typedef short int int16_t;
40 typedef long long int int64_t;
44 typedef unsigned char uint8_t;
45 typedef unsigned short int uint16_t;
46 typedef unsigned int uint32_t;
47 typedef unsigned long long int uint64_t;
53 typedef signed char int_least8_t;
54 typedef short int int_least16_t;
55 typedef int int_least32_t;
56 typedef long long int int_least64_t;
59 typedef unsigned char uint_least8_t;
60 typedef unsigned short int uint_least16_t;
61 typedef unsigned int uint_least32_t;
62 typedef unsigned long long int uint_least64_t;
68 typedef signed char int_fast8_t;
69 typedef int int_fast16_t;
70 typedef int int_fast32_t;
71 typedef long long int int_fast64_t;
74 typedef unsigned char uint_fast8_t;
75 typedef unsigned int uint_fast16_t;
76 typedef unsigned int uint_fast32_t;
77 typedef unsigned long long int uint_fast64_t;
80 /* Types for `void *' pointers. */
83 # define intptr_t intptr_t
85 typedef unsigned int uintptr_t;
88 /* Largest integral types. */
89 typedef long long int intmax_t;
90 typedef unsigned long long int uintmax_t;
93 /* The ISO C 9X standard specifies that these macros must only be
94 defined if explicitly requested. */
95 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
97 /* Limits of integral types. */
99 /* Minimum of signed integral types. */
100 # define INT8_MIN (-128)
101 # define INT16_MIN (-32767-1)
102 # define INT32_MIN (-2147483647-1)
103 # define INT64_MIN (-9223372036854775807LL-1)
104 /* Maximum of signed integral types. */
105 # define INT8_MAX (127)
106 # define INT16_MAX (32767)
107 # define INT32_MAX (2147483647)
108 # define INT64_MAX (9223372036854775807LL)
110 /* Maximum of unsigned integral types. */
111 # define UINT8_MAX (255U)
112 # define UINT16_MAX (65535U)
113 # define UINT32_MAX (4294967295U)
114 # define UINT64_MAX (18446744073709551615uLL)
117 /* Minimum of signed integral types having a minimum size. */
118 # define INT_LEAST8_MIN (-128)
119 # define INT_LEAST16_MIN (-32767-1)
120 # define INT_LEAST32_MIN (-2147483647-1)
121 # define INT_LEAST64_MIN (-9223372036854775807LL-1)
122 /* Maximum of signed integral types having a minimum size. */
123 # define INT_LEAST8_MAX (127)
124 # define INT_LEAST16_MAX (32767)
125 # define INT_LEAST32_MAX (2147483647)
126 # define INT_LEAST64_MAX (9223372036854775807LL)
128 /* Maximum of unsigned integral types having a minimum size. */
129 # define UINT_LEAST8_MAX (255U)
130 # define UINT_LEAST16_MAX (65535U)
131 # define UINT_LEAST32_MAX (4294967295U)
132 # define UINT_LEAST64_MAX (18446744073709551615uLL)
135 /* Minimum of fast signed integral types having a minimum size. */
136 # define INT_FAST8_MIN (-128)
137 # define INT_FAST16_MIN (-2147483647-1)
138 # define INT_FAST32_MIN (-2147483647-1)
139 # define INT_FAST64_MIN (-9223372036854775807LL-1)
140 /* Maximum of fast signed integral types having a minimum size. */
141 # define INT_FAST8_MAX (127)
142 # define INT_FAST16_MAX (2147483647)
143 # define INT_FAST32_MAX (2147483647)
144 # define INT_FAST64_MAX (9223372036854775807LL)
146 /* Maximum of fast unsigned integral types having a minimum size. */
147 # define UINT_FAST8_MAX (255U)
148 # define UINT_FAST16_MAX (4294967295U)
149 # define UINT_FAST32_MAX (4294967295U)
150 # define UINT_FAST64_MAX (18446744073709551615uLL)
153 /* Values to test for integral types holding `void *' pointer. */
154 # define INTPTR_MIN (-2147483647-1)
155 # define INTPTR_MAX (2147483647)
156 # define UINTPTR_MAX (4294967295U)
159 /* Minimum for largest signed integral type. */
160 # define INTMAX_MIN (-9223372036854775807LL-1)
161 /* Maximum for largest signed integral type. */
162 # define INTMAX_MAX (9223372036854775807LL)
164 /* Maximum for largest unsigned integral type. */
165 # define UINTMAX_MAX (18446744073709551615uLL)
168 /* Limits of other integer types. */
170 /* Limits of `ptrdiff_t' type. */
171 # define PTRDIFF_MIN (-2147483647-1)
172 # define PTRDIFF_MAX (2147483647)
174 /* Limits of `sig_atomic_t'. */
175 # define SIG_ATOMIC_MIN (-2147483647-1)
176 # define SIG_ATOMIC_MAX (2147483647)
178 /* Limit of `size_t' type. */
179 # define SIZE_MAX (4294967295U)
181 /* Limits of `wchar_t'. */
183 /* These constants might also be defined in <wchar.h>. */
184 # define WCHAR_MIN (-2147483647-1)
185 # define WCHAR_MAX (2147483647)
188 /* Limits of `wint_t'. */
189 # define WINT_MIN (0)
190 # define WINT_MAX (4294967295U)
192 #endif /* C++ && limit macros */
195 /* The ISO C 9X standard specifies that these macros must only be
196 defined if explicitly requested. */
197 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
200 # define INT8_C(c) ((int8_t) c)
201 # define INT16_C(c) ((int16_t) c)
202 # define INT32_C(c) ((int32_t) c)
203 # define INT64_C(c) ((int64_t) __CONCAT (c,ll))
206 # define UINT8_C(c) ((uint8_t) __CONCAT (c,u))
207 # define UINT16_C(c) ((uint16_t) __CONCAT (c,u))
208 # define UINT32_C(c) ((uint32_t) __CONCAT (c,u))
209 # define UINT64_C(c) ((uint64_t) __CONCAT (c,ull))
212 # define INTMAX_C(c) ((intmax_t) __CONCAT (c,ll))
213 # define UINTMAX_C(c) ((uintmax_t) __CONCAT (c,ull))
215 #endif /* C++ && constant macros */
217 #endif /* stdint.h */