Update.
[glibc.git] / sysdeps / wordsize-32 / stdint.h
blobef3de98620a65578693b414468b0ca38b3593114
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>
23 #ifndef _STDINT_H
24 #define _STDINT_H 1
26 #include <features.h>
27 #define __need_wchar_t
28 #include <stddef.h>
30 /* Exact integral types. */
32 /* Signed. */
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;
39 typedef int int32_t;
40 __extension__
41 typedef long long int int64_t;
42 #endif
44 /* Unsigned. */
45 typedef unsigned char uint8_t;
46 typedef unsigned short int uint16_t;
47 typedef unsigned int uint32_t;
48 __extension__
49 typedef unsigned long long int uint64_t;
52 /* Small types. */
54 /* Signed. */
55 typedef signed char int_least8_t;
56 typedef short int int_least16_t;
57 typedef int int_least32_t;
58 __extension__
59 typedef long long int int_least64_t;
61 /* Unsigned. */
62 typedef unsigned char uint_least8_t;
63 typedef unsigned short int uint_least16_t;
64 typedef unsigned int uint_least32_t;
65 __extension__
66 typedef unsigned long long int uint_least64_t;
69 /* Fast types. */
71 /* Signed. */
72 typedef signed char int_fast8_t;
73 typedef int int_fast16_t;
74 typedef int int_fast32_t;
75 __extension__
76 typedef long long int int_fast64_t;
78 /* Unsigned. */
79 typedef unsigned char uint_fast8_t;
80 typedef unsigned int uint_fast16_t;
81 typedef unsigned int uint_fast32_t;
82 __extension__
83 typedef unsigned long long int uint_fast64_t;
86 /* Types for `void *' pointers. */
87 #ifndef intptr_t
88 typedef int intptr_t;
89 # define intptr_t intptr_t
90 #endif
91 typedef unsigned int uintptr_t;
94 /* Largest integral types. */
95 __extension__ typedef long long int intmax_t;
96 __extension__ typedef unsigned long long int uintmax_t;
99 /* The ISO C 9X standard specifies that these macros must only be
100 defined if explicitly requested. */
101 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
103 /* Limits of integral types. */
105 /* Minimum of signed integral types. */
106 # define INT8_MIN (-128)
107 # define INT16_MIN (-32767-1)
108 # define INT32_MIN (-2147483647-1)
109 # define INT64_MIN (-9223372036854775807LL-1)
110 /* Maximum of signed integral types. */
111 # define INT8_MAX (127)
112 # define INT16_MAX (32767)
113 # define INT32_MAX (2147483647)
114 # define INT64_MAX (9223372036854775807LL)
116 /* Maximum of unsigned integral types. */
117 # define UINT8_MAX (255U)
118 # define UINT16_MAX (65535U)
119 # define UINT32_MAX (4294967295U)
120 # define UINT64_MAX (18446744073709551615uLL)
123 /* Minimum of signed integral types having a minimum size. */
124 # define INT_LEAST8_MIN (-128)
125 # define INT_LEAST16_MIN (-32767-1)
126 # define INT_LEAST32_MIN (-2147483647-1)
127 # define INT_LEAST64_MIN (-9223372036854775807LL-1)
128 /* Maximum of signed integral types having a minimum size. */
129 # define INT_LEAST8_MAX (127)
130 # define INT_LEAST16_MAX (32767)
131 # define INT_LEAST32_MAX (2147483647)
132 # define INT_LEAST64_MAX (9223372036854775807LL)
134 /* Maximum of unsigned integral types having a minimum size. */
135 # define UINT_LEAST8_MAX (255U)
136 # define UINT_LEAST16_MAX (65535U)
137 # define UINT_LEAST32_MAX (4294967295U)
138 # define UINT_LEAST64_MAX (18446744073709551615uLL)
141 /* Minimum of fast signed integral types having a minimum size. */
142 # define INT_FAST8_MIN (-128)
143 # define INT_FAST16_MIN (-2147483647-1)
144 # define INT_FAST32_MIN (-2147483647-1)
145 # define INT_FAST64_MIN (-9223372036854775807LL-1)
146 /* Maximum of fast signed integral types having a minimum size. */
147 # define INT_FAST8_MAX (127)
148 # define INT_FAST16_MAX (2147483647)
149 # define INT_FAST32_MAX (2147483647)
150 # define INT_FAST64_MAX (9223372036854775807LL)
152 /* Maximum of fast unsigned integral types having a minimum size. */
153 # define UINT_FAST8_MAX (255U)
154 # define UINT_FAST16_MAX (4294967295U)
155 # define UINT_FAST32_MAX (4294967295U)
156 # define UINT_FAST64_MAX (18446744073709551615uLL)
159 /* Values to test for integral types holding `void *' pointer. */
160 # define INTPTR_MIN (-2147483647-1)
161 # define INTPTR_MAX (2147483647)
162 # define UINTPTR_MAX (4294967295U)
165 /* Minimum for largest signed integral type. */
166 # define INTMAX_MIN (-9223372036854775807LL-1)
167 /* Maximum for largest signed integral type. */
168 # define INTMAX_MAX (9223372036854775807LL)
170 /* Maximum for largest unsigned integral type. */
171 # define UINTMAX_MAX (18446744073709551615uLL)
174 /* Limits of other integer types. */
176 /* Limits of `ptrdiff_t' type. */
177 # define PTRDIFF_MIN (-2147483647-1)
178 # define PTRDIFF_MAX (2147483647)
180 /* Limits of `sig_atomic_t'. */
181 # define SIG_ATOMIC_MIN (-2147483647-1)
182 # define SIG_ATOMIC_MAX (2147483647)
184 /* Limit of `size_t' type. */
185 # define SIZE_MAX (4294967295U)
187 /* Limits of `wchar_t'. */
188 # ifndef WCHAR_MIN
189 /* These constants might also be defined in <wchar.h>. */
190 # define WCHAR_MIN (-2147483647-1)
191 # define WCHAR_MAX (2147483647)
192 # endif
194 /* Limits of `wint_t'. */
195 # define WINT_MIN (0)
196 # define WINT_MAX (4294967295U)
198 #endif /* C++ && limit macros */
201 /* The ISO C 9X standard specifies that these macros must only be
202 defined if explicitly requested. */
203 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
205 /* Signed. */
206 # define INT8_C(c) ((int8_t) c)
207 # define INT16_C(c) ((int16_t) c)
208 # define INT32_C(c) ((int32_t) c)
209 # define INT64_C(c) ((int64_t) __CONCAT (c,ll))
211 /* Unsigned. */
212 # define UINT8_C(c) ((uint8_t) __CONCAT (c,u))
213 # define UINT16_C(c) ((uint16_t) __CONCAT (c,u))
214 # define UINT32_C(c) ((uint32_t) __CONCAT (c,u))
215 # define UINT64_C(c) ((uint64_t) __CONCAT (c,ull))
217 /* Maximal type. */
218 # define INTMAX_C(c) ((intmax_t) __CONCAT (c,ll))
219 # define UINTMAX_C(c) ((uintmax_t) __CONCAT (c,ull))
221 #endif /* C++ && constant macros */
223 #endif /* stdint.h */