| 1 | /* Copyright (C) 1997-2018 Free Software Foundation, Inc. | 
| 2 |    This file is part of the GNU C Library. | 
| 3 |  | 
| 4 |    The GNU C Library is free software; you can redistribute it and/or | 
| 5 |    modify it under the terms of the GNU Lesser General Public | 
| 6 |    License as published by the Free Software Foundation; either | 
| 7 |    version 2.1 of the License, or (at your option) any later version. | 
| 8 |  | 
| 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 |    Lesser General Public License for more details. | 
| 13 |  | 
| 14 |    You should have received a copy of the GNU Lesser General Public | 
| 15 |    License along with the GNU C Library; if not, see | 
| 16 |    <http://www.gnu.org/licenses/>.  */ | 
| 17 |  | 
| 18 | /* | 
| 19 |  *	ISO C99: 7.18 Integer types <stdint.h> | 
| 20 |  */ | 
| 21 |  | 
| 22 | #ifndef _STDINT_H | 
| 23 | #define _STDINT_H	1 | 
| 24 |  | 
| 25 | #define  | 
| 26 | #include <bits/libc-header-start.h> | 
| 27 | #include <bits/types.h> | 
| 28 | #include <bits/wchar.h> | 
| 29 | #include <bits/wordsize.h> | 
| 30 |  | 
| 31 | /* Exact integral types.  */ | 
| 32 |  | 
| 33 | /* Signed.  */ | 
| 34 | #include <bits/stdint-intn.h> | 
| 35 |  | 
| 36 | /* Unsigned.  */ | 
| 37 | #include <bits/stdint-uintn.h> | 
| 38 |  | 
| 39 |  | 
| 40 | /* Small types.  */ | 
| 41 |  | 
| 42 | /* Signed.  */ | 
| 43 | typedef signed char		int_least8_t; | 
| 44 | typedef short int		int_least16_t; | 
| 45 | typedef int			int_least32_t; | 
| 46 | #if __WORDSIZE == 64 | 
| 47 | typedef long int		int_least64_t; | 
| 48 | #else | 
| 49 | __extension__ | 
| 50 | typedef long long int		int_least64_t; | 
| 51 | #endif | 
| 52 |  | 
| 53 | /* Unsigned.  */ | 
| 54 | typedef unsigned char		uint_least8_t; | 
| 55 | typedef unsigned short int	uint_least16_t; | 
| 56 | typedef unsigned int		uint_least32_t; | 
| 57 | #if __WORDSIZE == 64 | 
| 58 | typedef unsigned long int	uint_least64_t; | 
| 59 | #else | 
| 60 | __extension__ | 
| 61 | typedef unsigned long long int	uint_least64_t; | 
| 62 | #endif | 
| 63 |  | 
| 64 |  | 
| 65 | /* Fast types.  */ | 
| 66 |  | 
| 67 | /* Signed.  */ | 
| 68 | typedef signed char		int_fast8_t; | 
| 69 | #if __WORDSIZE == 64 | 
| 70 | typedef long int		int_fast16_t; | 
| 71 | typedef long int		int_fast32_t; | 
| 72 | typedef long int		int_fast64_t; | 
| 73 | #else | 
| 74 | typedef int			int_fast16_t; | 
| 75 | typedef int			int_fast32_t; | 
| 76 | __extension__ | 
| 77 | typedef long long int		int_fast64_t; | 
| 78 | #endif | 
| 79 |  | 
| 80 | /* Unsigned.  */ | 
| 81 | typedef unsigned char		uint_fast8_t; | 
| 82 | #if __WORDSIZE == 64 | 
| 83 | typedef unsigned long int	uint_fast16_t; | 
| 84 | typedef unsigned long int	uint_fast32_t; | 
| 85 | typedef unsigned long int	uint_fast64_t; | 
| 86 | #else | 
| 87 | typedef unsigned int		uint_fast16_t; | 
| 88 | typedef unsigned int		uint_fast32_t; | 
| 89 | __extension__ | 
| 90 | typedef unsigned long long int	uint_fast64_t; | 
| 91 | #endif | 
| 92 |  | 
| 93 |  | 
| 94 | /* Types for `void *' pointers.  */ | 
| 95 | #if __WORDSIZE == 64 | 
| 96 | # ifndef __intptr_t_defined | 
| 97 | typedef long int		intptr_t; | 
| 98 | #  define __intptr_t_defined | 
| 99 | # endif | 
| 100 | typedef unsigned long int	uintptr_t; | 
| 101 | #else | 
| 102 | # ifndef __intptr_t_defined | 
| 103 | typedef int			intptr_t; | 
| 104 | #  define __intptr_t_defined | 
| 105 | # endif | 
| 106 | typedef unsigned int		uintptr_t; | 
| 107 | #endif | 
| 108 |  | 
| 109 |  | 
| 110 | /* Largest integral types.  */ | 
| 111 | typedef __intmax_t		intmax_t; | 
| 112 | typedef __uintmax_t		uintmax_t; | 
| 113 |  | 
| 114 |  | 
| 115 | # if __WORDSIZE == 64 | 
| 116 | #  define __INT64_C(c)	c ## L | 
| 117 | #  define __UINT64_C(c)	c ## UL | 
| 118 | # else | 
| 119 | #  define __INT64_C(c)	c ## LL | 
| 120 | #  define __UINT64_C(c)	c ## ULL | 
| 121 | # endif | 
| 122 |  | 
| 123 | /* Limits of integral types.  */ | 
| 124 |  | 
| 125 | /* Minimum of signed integral types.  */ | 
| 126 | # define INT8_MIN		(-128) | 
| 127 | # define INT16_MIN		(-32767-1) | 
| 128 | # define INT32_MIN		(-2147483647-1) | 
| 129 | # define INT64_MIN		(-__INT64_C(9223372036854775807)-1) | 
| 130 | /* Maximum of signed integral types.  */ | 
| 131 | # define INT8_MAX		(127) | 
| 132 | # define INT16_MAX		(32767) | 
| 133 | # define INT32_MAX		(2147483647) | 
| 134 | # define INT64_MAX		(__INT64_C(9223372036854775807)) | 
| 135 |  | 
| 136 | /* Maximum of unsigned integral types.  */ | 
| 137 | # define UINT8_MAX		(255) | 
| 138 | # define UINT16_MAX		(65535) | 
| 139 | # define UINT32_MAX		(4294967295U) | 
| 140 | # define UINT64_MAX		(__UINT64_C(18446744073709551615)) | 
| 141 |  | 
| 142 |  | 
| 143 | /* Minimum of signed integral types having a minimum size.  */ | 
| 144 | # define INT_LEAST8_MIN		(-128) | 
| 145 | # define INT_LEAST16_MIN	(-32767-1) | 
| 146 | # define INT_LEAST32_MIN	(-2147483647-1) | 
| 147 | # define INT_LEAST64_MIN	(-__INT64_C(9223372036854775807)-1) | 
| 148 | /* Maximum of signed integral types having a minimum size.  */ | 
| 149 | # define INT_LEAST8_MAX		(127) | 
| 150 | # define INT_LEAST16_MAX	(32767) | 
| 151 | # define INT_LEAST32_MAX	(2147483647) | 
| 152 | # define INT_LEAST64_MAX	(__INT64_C(9223372036854775807)) | 
| 153 |  | 
| 154 | /* Maximum of unsigned integral types having a minimum size.  */ | 
| 155 | # define UINT_LEAST8_MAX	(255) | 
| 156 | # define UINT_LEAST16_MAX	(65535) | 
| 157 | # define UINT_LEAST32_MAX	(4294967295U) | 
| 158 | # define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615)) | 
| 159 |  | 
| 160 |  | 
| 161 | /* Minimum of fast signed integral types having a minimum size.  */ | 
| 162 | # define INT_FAST8_MIN		(-128) | 
| 163 | # if __WORDSIZE == 64 | 
| 164 | #  define INT_FAST16_MIN	(-9223372036854775807L-1) | 
| 165 | #  define INT_FAST32_MIN	(-9223372036854775807L-1) | 
| 166 | # else | 
| 167 | #  define INT_FAST16_MIN	(-2147483647-1) | 
| 168 | #  define INT_FAST32_MIN	(-2147483647-1) | 
| 169 | # endif | 
| 170 | # define INT_FAST64_MIN		(-__INT64_C(9223372036854775807)-1) | 
| 171 | /* Maximum of fast signed integral types having a minimum size.  */ | 
| 172 | # define INT_FAST8_MAX		(127) | 
| 173 | # if __WORDSIZE == 64 | 
| 174 | #  define INT_FAST16_MAX	(9223372036854775807L) | 
| 175 | #  define INT_FAST32_MAX	(9223372036854775807L) | 
| 176 | # else | 
| 177 | #  define INT_FAST16_MAX	(2147483647) | 
| 178 | #  define INT_FAST32_MAX	(2147483647) | 
| 179 | # endif | 
| 180 | # define INT_FAST64_MAX		(__INT64_C(9223372036854775807)) | 
| 181 |  | 
| 182 | /* Maximum of fast unsigned integral types having a minimum size.  */ | 
| 183 | # define UINT_FAST8_MAX		(255) | 
| 184 | # if __WORDSIZE == 64 | 
| 185 | #  define UINT_FAST16_MAX	(18446744073709551615UL) | 
| 186 | #  define UINT_FAST32_MAX	(18446744073709551615UL) | 
| 187 | # else | 
| 188 | #  define UINT_FAST16_MAX	(4294967295U) | 
| 189 | #  define UINT_FAST32_MAX	(4294967295U) | 
| 190 | # endif | 
| 191 | # define UINT_FAST64_MAX	(__UINT64_C(18446744073709551615)) | 
| 192 |  | 
| 193 |  | 
| 194 | /* Values to test for integral types holding `void *' pointer.  */ | 
| 195 | # if __WORDSIZE == 64 | 
| 196 | #  define INTPTR_MIN		(-9223372036854775807L-1) | 
| 197 | #  define INTPTR_MAX		(9223372036854775807L) | 
| 198 | #  define UINTPTR_MAX		(18446744073709551615UL) | 
| 199 | # else | 
| 200 | #  define INTPTR_MIN		(-2147483647-1) | 
| 201 | #  define INTPTR_MAX		(2147483647) | 
| 202 | #  define UINTPTR_MAX		(4294967295U) | 
| 203 | # endif | 
| 204 |  | 
| 205 |  | 
| 206 | /* Minimum for largest signed integral type.  */ | 
| 207 | # define INTMAX_MIN		(-__INT64_C(9223372036854775807)-1) | 
| 208 | /* Maximum for largest signed integral type.  */ | 
| 209 | # define INTMAX_MAX		(__INT64_C(9223372036854775807)) | 
| 210 |  | 
| 211 | /* Maximum for largest unsigned integral type.  */ | 
| 212 | # define UINTMAX_MAX		(__UINT64_C(18446744073709551615)) | 
| 213 |  | 
| 214 |  | 
| 215 | /* Limits of other integer types.  */ | 
| 216 |  | 
| 217 | /* Limits of `ptrdiff_t' type.  */ | 
| 218 | # if __WORDSIZE == 64 | 
| 219 | #  define PTRDIFF_MIN		(-9223372036854775807L-1) | 
| 220 | #  define PTRDIFF_MAX		(9223372036854775807L) | 
| 221 | # else | 
| 222 | #  if __WORDSIZE32_PTRDIFF_LONG | 
| 223 | #   define PTRDIFF_MIN		(-2147483647L-1) | 
| 224 | #   define PTRDIFF_MAX		(2147483647L) | 
| 225 | #  else | 
| 226 | #   define PTRDIFF_MIN		(-2147483647-1) | 
| 227 | #   define PTRDIFF_MAX		(2147483647) | 
| 228 | #  endif | 
| 229 | # endif | 
| 230 |  | 
| 231 | /* Limits of `sig_atomic_t'.  */ | 
| 232 | # define SIG_ATOMIC_MIN		(-2147483647-1) | 
| 233 | # define SIG_ATOMIC_MAX		(2147483647) | 
| 234 |  | 
| 235 | /* Limit of `size_t' type.  */ | 
| 236 | # if __WORDSIZE == 64 | 
| 237 | #  define SIZE_MAX		(18446744073709551615UL) | 
| 238 | # else | 
| 239 | #  if __WORDSIZE32_SIZE_ULONG | 
| 240 | #   define SIZE_MAX		(4294967295UL) | 
| 241 | #  else | 
| 242 | #   define SIZE_MAX		(4294967295U) | 
| 243 | #  endif | 
| 244 | # endif | 
| 245 |  | 
| 246 | /* Limits of `wchar_t'.  */ | 
| 247 | # ifndef WCHAR_MIN | 
| 248 | /* These constants might also be defined in <wchar.h>.  */ | 
| 249 | #  define WCHAR_MIN		__WCHAR_MIN | 
| 250 | #  define WCHAR_MAX		__WCHAR_MAX | 
| 251 | # endif | 
| 252 |  | 
| 253 | /* Limits of `wint_t'.  */ | 
| 254 | # define WINT_MIN		(0u) | 
| 255 | # define WINT_MAX		(4294967295u) | 
| 256 |  | 
| 257 | /* Signed.  */ | 
| 258 | # define INT8_C(c)	c | 
| 259 | # define INT16_C(c)	c | 
| 260 | # define INT32_C(c)	c | 
| 261 | # if __WORDSIZE == 64 | 
| 262 | #  define INT64_C(c)	c ## L | 
| 263 | # else | 
| 264 | #  define INT64_C(c)	c ## LL | 
| 265 | # endif | 
| 266 |  | 
| 267 | /* Unsigned.  */ | 
| 268 | # define UINT8_C(c)	c | 
| 269 | # define UINT16_C(c)	c | 
| 270 | # define UINT32_C(c)	c ## U | 
| 271 | # if __WORDSIZE == 64 | 
| 272 | #  define UINT64_C(c)	c ## UL | 
| 273 | # else | 
| 274 | #  define UINT64_C(c)	c ## ULL | 
| 275 | # endif | 
| 276 |  | 
| 277 | /* Maximal type.  */ | 
| 278 | # if __WORDSIZE == 64 | 
| 279 | #  define INTMAX_C(c)	c ## L | 
| 280 | #  define UINTMAX_C(c)	c ## UL | 
| 281 | # else | 
| 282 | #  define INTMAX_C(c)	c ## LL | 
| 283 | #  define UINTMAX_C(c)	c ## ULL | 
| 284 | # endif | 
| 285 |  | 
| 286 | #if __GLIBC_USE (IEC_60559_BFP_EXT) | 
| 287 |  | 
| 288 | # define INT8_WIDTH 8 | 
| 289 | # define UINT8_WIDTH 8 | 
| 290 | # define INT16_WIDTH 16 | 
| 291 | # define UINT16_WIDTH 16 | 
| 292 | # define INT32_WIDTH 32 | 
| 293 | # define UINT32_WIDTH 32 | 
| 294 | # define INT64_WIDTH 64 | 
| 295 | # define UINT64_WIDTH 64 | 
| 296 |  | 
| 297 | # define INT_LEAST8_WIDTH 8 | 
| 298 | # define UINT_LEAST8_WIDTH 8 | 
| 299 | # define INT_LEAST16_WIDTH 16 | 
| 300 | # define UINT_LEAST16_WIDTH 16 | 
| 301 | # define INT_LEAST32_WIDTH 32 | 
| 302 | # define UINT_LEAST32_WIDTH 32 | 
| 303 | # define INT_LEAST64_WIDTH 64 | 
| 304 | # define UINT_LEAST64_WIDTH 64 | 
| 305 |  | 
| 306 | # define INT_FAST8_WIDTH 8 | 
| 307 | # define UINT_FAST8_WIDTH 8 | 
| 308 | # define INT_FAST16_WIDTH __WORDSIZE | 
| 309 | # define UINT_FAST16_WIDTH __WORDSIZE | 
| 310 | # define INT_FAST32_WIDTH __WORDSIZE | 
| 311 | # define UINT_FAST32_WIDTH __WORDSIZE | 
| 312 | # define INT_FAST64_WIDTH 64 | 
| 313 | # define UINT_FAST64_WIDTH 64 | 
| 314 |  | 
| 315 | # define INTPTR_WIDTH __WORDSIZE | 
| 316 | # define UINTPTR_WIDTH __WORDSIZE | 
| 317 |  | 
| 318 | # define INTMAX_WIDTH 64 | 
| 319 | # define UINTMAX_WIDTH 64 | 
| 320 |  | 
| 321 | # define PTRDIFF_WIDTH __WORDSIZE | 
| 322 | # define SIG_ATOMIC_WIDTH 32 | 
| 323 | # define SIZE_WIDTH __WORDSIZE | 
| 324 | # define WCHAR_WIDTH 32 | 
| 325 | # define WINT_WIDTH 32 | 
| 326 |  | 
| 327 | #endif | 
| 328 |  | 
| 329 | #endif /* stdint.h */ | 
| 330 |  |