1 /* Copyright (C) 1997 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 Integral types <inttypes.h>
28 #define __need_wchar_t
31 /* Exact integral types. */
35 /* There is some amount of overlap with <sys/types.h> as known by inet code */
36 #ifndef __int8_t_defined
37 # define __int8_t_defined
38 typedef signed char int8_t;
39 typedef short int int16_t;
41 typedef long long int int64_t;
45 typedef unsigned char uint8_t;
46 typedef unsigned short int uint16_t;
47 typedef unsigned int uint32_t;
48 typedef unsigned long long int uint64_t;
51 /* Largest integral types. */
52 typedef long long int intmax_t;
53 typedef unsigned long long int uintmax_t;
56 /* Types for `void *' pointers. */
58 typedef unsigned int uintptr_t;
61 /* Efficient types. */
62 typedef int intfast_t
;
63 typedef unsigned int uintfast_t
;
69 typedef signed char int_least8_t;
70 typedef short int int_least16_t;
71 typedef int int_least32_t;
72 typedef long long int int_least64_t;
75 typedef unsigned char uint_least8_t;
76 typedef unsigned short int uint_least16_t;
77 typedef unsigned int uint_least32_t;
78 typedef unsigned long long int uint_least64_t;
84 typedef signed char int_fast8_t;
85 typedef int int_fast16_t;
86 typedef int int_fast32_t;
87 typedef long long int int_fast64_t;
90 typedef unsigned char uint_fast8_t;
91 typedef unsigned int uint_fast16_t;
92 typedef unsigned int uint_fast32_t;
93 typedef unsigned long long int uint_fast64_t;
96 /* Limits of integral types. */
98 /* Minimum of signed integral types. */
99 #define INT8_MIN (-128)
100 #define INT16_MIN (-32767-1)
101 #define INT32_MIN (-2147483647-1)
102 #define INT64_MIN (-9223372036854775807LL-1)
103 /* Maximum of signed integral types. */
104 #define INT8_MAX (127)
105 #define INT16_MAX (32767)
106 #define INT32_MAX (2147483647)
107 #define INT64_MAX (9223372036854775807LL)
109 /* Maximum of unsigned integral types. */
110 #define UINT8_MAX (255U)
111 #define UINT16_MAX (65535U)
112 #define UINT32_MAX (4294967295U)
113 #define UINT64_MAX (18446744073709551615uLL)
116 /* Minimum of signed integral types having a minimum size. */
117 #define INT_LEAST8_MIN (-128)
118 #define INT_LEAST16_MIN (-32767-1)
119 #define INT_LEAST32_MIN (-2147483647-1)
120 #define INT_LEAST64_MIN (-9223372036854775807LL-1)
121 /* Maximum of signed integral types having a minimum size. */
122 #define INT_LEAST8_MAX (127)
123 #define INT_LEAST16_MAX (32767)
124 #define INT_LEAST32_MAX (2147483647)
125 #define INT_LEAST64_MAX (9223372036854775807LL)
127 /* Maximum of unsigned integral types having a minimum size. */
128 #define UINT_LEAST8_MAX (255U)
129 #define UINT_LEAST16_MAX (65535U)
130 #define UINT_LEAST32_MAX (4294967295U)
131 #define UINT_LEAST64_MAX (18446744073709551615uLL)
134 /* Minimum of fast signed integral types having a minimum size. */
135 #define INT_FAST8_MIN (-128)
136 #define INT_FAST16_MIN (-2147483647-1)
137 #define INT_FAST32_MIN (-2147483647-1)
138 #define INT_FAST64_MIN (-9223372036854775807LL-1)
139 /* Maximum of fast signed integral types having a minimum size. */
140 #define INT_FAST8_MAX (127)
141 #define INT_FAST16_MAX (2147483647)
142 #define INT_FAST32_MAX (2147483647)
143 #define INT_FAST64_MAX (9223372036854775807LL)
145 /* Maximum of fast unsigned integral types having a minimum size. */
146 #define UINT_FAST8_MAX (255U)
147 #define UINT_FAST16_MAX (4294967295U)
148 #define UINT_FAST32_MAX (4294967295U)
149 #define UINT_FAST64_MAX (18446744073709551615uLL)
152 /* Minimum for most efficient signed integral types. */
153 #define INTFAST_MIN (-2147483647-1)
154 /* Maximum for most efficient signed integral types. */
155 #define INTFAST_MAX (2147483647)
157 /* Maximum for most efficient unsigned integral types. */
158 #define UINTFAST_MAX (4294967295U)
161 /* Minimum for largest signed integral type. */
162 #define INTMAX_MIN (-9223372036854775807LL-1)
163 /* Maximum for largest signed integral type. */
164 #define INTMAX_MAX (9223372036854775807LL)
166 /* Maximum for largest unsigned integral type. */
167 #define UINTMAX_MAX (18446744073709551615uLL)
170 /* Values to test for integral types holding `void *' pointer. */
171 #define INTPTR_MAX (2147483647)
172 #define UINTPTR_MAX (4294967295U)
176 #define INT8_C(c) ((int8_t) c)
177 #define INT16_C(c) ((int16_t) c)
178 #define INT32_C(c) ((int32_t) c)
179 #define INT64_C(c) ((int64_t) __CONCAT (c,ll))
182 #define UINT8_C(c) ((uint8_t) __CONCAT (c,u))
183 #define UINT16_C(c) ((uint16_t) __CONCAT (c,u))
184 #define UINT32_C(c) ((uint32_t) __CONCAT (c,u))
185 #define UINT64_C(c) ((uint64_t) __CONCAT (c,ull))
188 #define INTMAX_C(c) ((intmax_t) __CONCAT (c,ll))
189 #define UINTMAX_C(c) ((uintmax_t) __CONCAT (c,ull))
192 /* Macros for printing format specifiers. */
194 /* Decimal notation. */
200 #define PRIdLEAST8 "d"
201 #define PRIdLEAST16 "d"
202 #define PRIdLEAST32 "d"
203 #define PRIdLEAST64 "lld"
205 #define PRIdFAST8 "d"
206 #define PRIdFAST16 "d"
207 #define PRIdFAST32 "d"
208 #define PRIdFAST64 "lld"
216 #define PRIiLEAST8 "i"
217 #define PRIiLEAST16 "i"
218 #define PRIiLEAST32 "i"
219 #define PRIiLEAST64 "lli"
221 #define PRIiFAST8 "i"
222 #define PRIiFAST16 "i"
223 #define PRIiFAST32 "i"
224 #define PRIiFAST64 "lli"
226 /* Octal notation. */
232 #define PRIoLEAST8 "o"
233 #define PRIoLEAST16 "o"
234 #define PRIoLEAST32 "o"
235 #define PRIoLEAST64 "llo"
237 #define PRIoFAST8 "o"
238 #define PRIoFAST16 "o"
239 #define PRIoFAST32 "o"
240 #define PRIoFAST64 "llo"
242 /* lowercase hexadecimal notation. */
248 #define PRIxLEAST8 "x"
249 #define PRIxLEAST16 "x"
250 #define PRIxLEAST32 "x"
251 #define PRIxLEAST64 "llx"
253 #define PRIxFAST8 "x"
254 #define PRIxFAST16 "x"
255 #define PRIxFAST32 "x"
256 #define PRIxFAST64 "llx"
258 /* UPPERCASE hexadecimal notation. */
264 #define PRIXLEAST8 "X"
265 #define PRIXLEAST16 "X"
266 #define PRIXLEAST32 "X"
267 #define PRIXLEAST64 "llX"
269 #define PRIXFAST8 "X"
270 #define PRIXFAST16 "X"
271 #define PRIXFAST32 "X"
272 #define PRIXFAST64 "llX"
275 /* Unsigned integers. */
281 #define PRIuLEAST8 "u"
282 #define PRIuLEAST16 "u"
283 #define PRIuLEAST32 "u"
284 #define PRIuLEAST64 "llu"
286 #define PRIuFAST8 "u"
287 #define PRIuFAST16 "u"
288 #define PRIuFAST32 "u"
289 #define PRIuFAST64 "llu"
292 /* Macros for printing `intmax_t' and `uintmax_t'. */
293 #define PRIdMAX "lld"
294 #define PRIoMAX "llo"
295 #define PRIxMAX "llx"
296 #define PRIuMAX "llu"
299 /* Macros for printing `intfast_t' and `uintfast_t'. */
306 /* Macros for printing `intptr_t' and `uintptr_t'. */
313 /* Macros for printing format specifiers. */
315 /* Decimal notation. */
331 /* Octal notation. */
337 /* Hexadecimal notation. */
344 /* Macros for scaning `intfast_t' and `uintfast_t'. */
350 /* Macros for scaning `intptr_t' and `uintptr_t'. */
357 /* Limits of other integer types. */
359 /* Limits of `ptrdiff_t' type. */
360 #define PTRDIFF_MIN (-2147483647-1)
361 #define PTRDIFF_MAX (2147483647)
363 /* Limits of `sig_atomic_t'. */
364 #define SIG_ATOMIC_MIN (-2147483647-1)
365 #define SIG_ATOMIC_MAX (2147483647)
367 /* Limit of `size_t' type. */
368 #define SIZE_MAX (4294967295U)
370 /* Limits of `wchar_t'. */
372 /* These constants might also be defined in <wchar.h>. */
373 # define WCHAR_MIN (-2147483647-1)
374 # define WCHAR_MAX (2147483647)
377 /* Limits of `wint_t'. */
379 #define WINT_MAX (4294967295U)
382 /* Macros for string conversion. */
384 /* Like `strtol' but convert to `intmax_t'. */
385 extern intmax_t strtoimax
__P ((__const
char *__restrict __nptr
,
386 char **__restrict __endptr
, int __base
));
388 /* Like `strtoul' but convert to `uintmax_t'. */
389 extern uintmax_t strtoumax
__P ((__const
char * __restrict __nptr
,
390 char ** __restrict __endptr
, int __base
));
392 /* Like `wcstol' but convert to `intmax_t'. */
393 extern intmax_t wcstoimax
__P ((__const
wchar_t * __restrict __nptr
,
394 wchar_t **__restrict __endptr
, int __base
));
396 /* Like `wcstoul' but convert to `uintmax_t'. */
397 extern uintmax_t wcstoumax
__P ((__const
wchar_t * __restrict __nptr
,
398 wchar_t ** __restrict __endptr
, int __base
));
400 #if defined __GNUC__ && __GNUC__ >= 2 && defined __OPTIMIZE__
402 /* Like `strtol' but convert to `intmax_t'. */
403 # ifndef __strtoll_internal_defined
404 extern long long int __strtoll_internal
__P ((__const
char *__restrict __nptr
,
405 char **__restrict __endptr
,
406 int __base
, int __group
));
407 # define __strtoll_internal_defined 1
409 extern __inline
intmax_t
410 strtoimax (__const
char *__restrict nptr
, char **__restrict endptr
, int base
)
412 return __strtoll_internal (nptr
, endptr
, base
, 0);
415 /* Like `strtoul' but convert to `uintmax_t'. */
416 # ifndef __strtoull_internal_defined
417 extern unsigned long long int __strtoull_internal
__P ((__const
char *
423 # define __strtoull_internal_defined 1
425 extern __inline
uintmax_t
426 strtoumax (__const
char *__restrict nptr
, char **__restrict endptr
, int base
)
428 return __strtoull_internal (nptr
, endptr
, base
, 0);
431 /* Like `wcstol' but convert to `intmax_t'. */
432 # ifndef __wcstoll_internal_defined
433 extern long long int __wcstoll_internal
__P ((__const
wchar_t *
435 wchar_t **__restrict __endptr
,
436 int __base
, int __group
));
437 # define __wcstoll_internal_defined 1
439 extern __inline
intmax_t
440 wcstoimax (__const
wchar_t *__restrict nptr
, wchar_t **__restrict endptr
,
443 return __wcstoll_internal (nptr
, endptr
, base
, 0);
447 /* Like `wcstoul' but convert to `uintmax_t'. */
448 # ifndef __wcstoull_internal_defined
449 extern unsigned long long int __wcstoull_internal
__P ((__const
wchar_t *
455 # define __wcstoull_internal_defined 1
457 extern __inline
uintmax_t
458 wcstoumax (__const
wchar_t *__restrict nptr
, wchar_t **__restrict endptr
,
461 return __wcstoull_internal (nptr
, endptr
, base
, 0);
463 #endif /* GCC and Optimization. */
465 #endif /* inttypes.h */