Update.
[glibc.git] / sysdeps / wordsize-64 / stdint.h
blob743fb434bf7bdaa58361d8f82acdb11bf95a8fe6
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 typedef long int int64_t;
41 #endif
43 /* Unsigned. */
44 typedef unsigned char uint8_t;
45 typedef unsigned short int uint16_t;
46 typedef unsigned int uint32_t;
47 typedef unsigned long int uint64_t;
50 /* Small types. */
52 /* Signed. */
53 typedef signed char int_least8_t;
54 typedef short int int_least16_t;
55 typedef int int_least32_t;
56 typedef long int int_least64_t;
58 /* Unsigned. */
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 int uint_least64_t;
65 /* Fast types. */
67 /* Signed. */
68 typedef signed char int_fast8_t;
69 typedef long int int_fast16_t;
70 typedef long int int_fast32_t;
71 typedef long int int_fast64_t;
73 /* Unsigned. */
74 typedef unsigned char uint_fast8_t;
75 typedef unsigned long int uint_fast16_t;
76 typedef unsigned long int uint_fast32_t;
77 typedef unsigned long int uint_fast64_t;
80 /* Types for `void *' pointers. */
81 #ifndef intptr_t
82 typedef long int intptr_t;
83 # define intptr_t intptr_t
84 #endif
85 typedef unsigned long int uintptr_t;
88 /* Largest integral types. */
89 typedef long int intmax_t;
90 typedef unsigned 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 (-9223372036854775807LL-1)
138 # define INT_FAST32_MIN (-9223372036854775807LL-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 (9223372036854775807LL)
143 # define INT_FAST32_MAX (9223372036854775807LL)
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 (18446744073709551615uLL)
149 # define UINT_FAST32_MAX (18446744073709551615uLL)
150 # define UINT_FAST64_MAX (18446744073709551615uLL)
153 /* Values to test for integral types holding `void *' pointer. */
154 # define INTPTR_MIN (-9223372036854775807L-1)
155 # define INTPTR_MAX (9223372036854775807L
156 # define UINTPTR_MAX (18446744073709551615uL)
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 (-9223372036854775807L-1)
172 # define PTRDIFF_MAX (9223372036854775807L)
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 (18446744073709551615uL)
181 /* Limits of `wchar_t'. */
182 # ifndef WCHAR_MIN
183 /* These constants might also be defined in <wchar.h>. */
184 # define WCHAR_MIN (-2147483647-1)
185 # define WCHAR_MAX (2147483647)
186 # endif
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
199 /* Signed. */
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,l))
205 /* Unsigned. */
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,ul))
211 /* Maximal type. */
212 # define INTMAX_C(c) ((intmax_t) __CONCAT (c,l))
213 # define UINTMAX_C(c) ((uintmax_t) __CONCAT (c,ul))
215 #endif /* C++ && constant macros */
217 #endif /* stdint.h */