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 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 int uint64_t;
51 /* Largest integral types. */
52 typedef long int intmax_t;
53 typedef unsigned long int uintmax_t;
56 /* Types for `void *' pointers. */
57 typedef long int intptr_t;
58 typedef unsigned long int uintptr_t;
61 /* Efficient types. */
62 typedef long int intfast_t
;
63 typedef unsigned long 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 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 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 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 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 (-9223372036854775807L-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 (9223372036854775807L)
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 (18446744073709551615uL)
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 (-9223372036854775807L-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 (9223372036854775807L)
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 (18446744073709551615uL)
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 (-9223372036854775807L-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 (9223372036854775807L)
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 (18446744073709551615uL)
152 /* Minimum for most efficient signed integral types. */
153 #define INTFAST_MIN (-9223372036854775807L-1)
154 /* Maximum for most efficient signed integral types. */
155 #define INTFAST_MAX (9223372036854775807L)
157 /* Maximum for most efficient unsigned integral types. */
158 #define UINTFAST_MAX (18446744073709551615uL)
161 /* Minimum for largest signed integral type. */
162 #define INTMAX_MIN (-9223372036854775807L-1)
163 /* Maximum for largest signed integral type. */
164 #define INTMAX_MAX (9223372036854775807L)
166 /* Maximum for largest unsigned integral type. */
167 #define UINTMAX_MAX (18446744073709551615uL)
170 /* Values to test for integral types holding `void *' pointer. */
171 #define INTPTR_MAX (9223372036854775807L)
172 #define UINTPTR_MAX (18446744073709551615uL)
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,l))
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,ul))
188 #define INTMAX_C(c) ((intmax_t) __CONCAT (c,l))
189 #define UINTMAX_C(c) ((uintmax_t) __CONCAT (c,ul))
192 /* Macros for printing format specifiers. */
194 /* Decimal notation. */
200 #define PRIdLEAST8 "d"
201 #define PRIdLEAST16 "d"
202 #define PRIdLEAST32 "d"
203 #define PRIdLEAST64 "ld"
205 #define PRIdFAST8 "d"
206 #define PRIdFAST16 "d"
207 #define PRIdFAST32 "d"
208 #define PRIdFAST64 "ld"
216 #define PRIiLEAST8 "i"
217 #define PRIiLEAST16 "i"
218 #define PRIiLEAST32 "i"
219 #define PRIiLEAST64 "li"
221 #define PRIiFAST8 "i"
222 #define PRIiFAST16 "i"
223 #define PRIiFAST32 "i"
224 #define PRIiFAST64 "li"
226 /* Octal notation. */
232 #define PRIoLEAST8 "o"
233 #define PRIoLEAST16 "o"
234 #define PRIoLEAST32 "o"
235 #define PRIoLEAST64 "lo"
237 #define PRIoFAST8 "o"
238 #define PRIoFAST16 "o"
239 #define PRIoFAST32 "o"
240 #define PRIoFAST64 "lo"
242 /* lowercase hexadecimal notation. */
248 #define PRIxLEAST8 "x"
249 #define PRIxLEAST16 "x"
250 #define PRIxLEAST32 "x"
251 #define PRIxLEAST64 "lx"
253 #define PRIxFAST8 "x"
254 #define PRIxFAST16 "x"
255 #define PRIxFAST32 "x"
256 #define PRIxFAST64 "lx"
258 /* UPPERCASE hexadecimal notation. */
264 #define PRIXLEAST8 "X"
265 #define PRIXLEAST16 "X"
266 #define PRIXLEAST32 "X"
267 #define PRIXLEAST64 "lX"
269 #define PRIXFAST8 "X"
270 #define PRIXFAST16 "X"
271 #define PRIXFAST32 "X"
272 #define PRIXFAST64 "lX"
275 /* Unsigned integers. */
281 #define PRIuLEAST8 "u"
282 #define PRIuLEAST16 "u"
283 #define PRIuLEAST32 "u"
284 #define PRIuLEAST64 "lu"
286 #define PRIuFAST8 "u"
287 #define PRIuFAST16 "u"
288 #define PRIuFAST32 "u"
289 #define PRIuFAST64 "lu"
292 /* Macros for printing `intmax_t' and `uintmax_t'. */
299 /* Macros for printing `intfast_t' and `uintfast_t'. */
300 #define PRIdFAST "ld"
301 #define PRIoFAST "lo"
302 #define PRIxFAST "lx"
303 #define PRIuFAST "lu"
306 /* Macros for printing `intptr_t' and `uintptr_t'. */
313 /* Macros for printing format specifiers. */
315 /* Decimal notation. */
324 /* Octal notation. */
329 /* Hexadecimal notation. */
335 /* Macros for scaning `intfast_t' and `uintfast_t'. */
336 #define SCNdFAST "ld"
337 #define SCNiFAST "li"
338 #define SCNoFAST "lo"
339 #define SCNxFAST "lx"
341 /* Macros for scaning `intptr_t' and `uintptr_t'. */
348 /* Limits of other integer types. */
350 /* Limits of `ptrdiff_t' type. */
351 #define PTRDIFF_MIN (-9223372036854775807L-1)
352 #define PTRDIFF_MAX (9223372036854775807L)
354 /* Limits of `sig_atomic_t'. */
355 #define SIG_ATOMIC_MIN (-2147483647-1)
356 #define SIG_ATOMIC_MAX (-2147483647-1)
358 /* Limit of `size_t' type. */
359 #define SIZE_MAX (18446744073709551615uL)
361 /* Limits of `wchar_t'. */
363 /* These constants might also be defined in <wchar.h>. */
364 # define WCHAR_MIN (-2147483647-1)
365 # define WCHAR_MAX (2147483647)
368 /* Limits of `wint_t'. */
370 #define WINT_MAX (4294967295U)
373 /* Macros for string conversion. */
375 /* Like `strtol' but convert to `intmax_t'. */
376 #define strtoimax(nptr, endptr, base) \
377 __strtol_internal (nptr, endptr, base, 0)
379 #ifndef __strtol_internal_defined
380 extern long int __strtol_internal
__P ((__const
char *__restrict __nptr
,
381 char **__restrict __endptr
,
382 int __base
, int __group
));
383 # define __strtol_internal_defined 1
387 /* Like `strtoul' but convert to `uintmax_t'. */
388 #define strtoumax(nptr, endptr, base) \
389 __strtoul_internal (nptr, endptr, base, 0)
391 #ifndef __strtoul_internal_defined
392 extern unsigned long int __strtoul_internal
__P ((__const
char *
394 char **__restrict __endptr
,
395 int __base
, int __group
));
396 # define __strtoul_internal_defined 1
400 /* Like `wcstol' but convert to `intmax_t'. */
401 #define wcstoimax(nptr, endptr, base) \
402 __wcstol_internal (nptr, endptr, base, 0)
404 #ifndef __wcstol_internal_defined
405 extern long int __wcstol_internal
__P ((__const
wchar_t *__restrict __nptr
,
406 wchar_t **__restrict __endptr
,
407 int __base
, int __group
));
408 # define __wcstol_internal_defined 1
412 /* Like `wcstoul' but convert to `uintmax_t'. */
413 #define wcstoumax(nptr, endptr, base) \
414 __wcstoul_internal (nptr, endptr, base, 0)
416 #ifndef __wcstoul_internal_defined
417 extern unsigned long int __wcstoul_internal
__P ((__const
wchar_t *
421 int __base
, int __group
));
422 # define __wcstoul_internal_defined 1
425 #endif /* inttypes.h */