Update.
[glibc.git] / sysdeps / wordsize-64 / inttypes.h
blob5e497dbfaef719c7eec9f8dcf3e2f2a45da4997e
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 Integral types <inttypes.h>
23 #ifndef _INTTYPES_H
24 #define _INTTYPES_H 1
26 #include <features.h>
27 /* Get the type definitions. */
28 #include <stdint.h>
31 /* The ISO C 9X standard specifies that these macros must only be
32 defined if explicitly requested. */
33 #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
35 /* Macros for printing format specifiers. */
37 /* Decimal notation. */
38 # define PRId8 "d"
39 # define PRId16 "d"
40 # define PRId32 "d"
41 # define PRId64 "ld"
43 # define PRIdLEAST8 "d"
44 # define PRIdLEAST16 "d"
45 # define PRIdLEAST32 "d"
46 # define PRIdLEAST64 "ld"
48 # define PRIdFAST8 "d"
49 # define PRIdFAST16 "d"
50 # define PRIdFAST32 "d"
51 # define PRIdFAST64 "ld"
54 # define PRIi8 "i"
55 # define PRIi16 "i"
56 # define PRIi32 "i"
57 # define PRIi64 "li"
59 # define PRIiLEAST8 "i"
60 # define PRIiLEAST16 "i"
61 # define PRIiLEAST32 "i"
62 # define PRIiLEAST64 "li"
64 # define PRIiFAST8 "i"
65 # define PRIiFAST16 "i"
66 # define PRIiFAST32 "i"
67 # define PRIiFAST64 "li"
69 /* Octal notation. */
70 # define PRIo8 "o"
71 # define PRIo16 "o"
72 # define PRIo32 "o"
73 # define PRIo64 "lo"
75 # define PRIoLEAST8 "o"
76 # define PRIoLEAST16 "o"
77 # define PRIoLEAST32 "o"
78 # define PRIoLEAST64 "lo"
80 # define PRIoFAST8 "o"
81 # define PRIoFAST16 "o"
82 # define PRIoFAST32 "o"
83 # define PRIoFAST64 "lo"
85 /* lowercase hexadecimal notation. */
86 # define PRIx8 "x"
87 # define PRIx16 "x"
88 # define PRIx32 "x"
89 # define PRIx64 "lx"
91 # define PRIxLEAST8 "x"
92 # define PRIxLEAST16 "x"
93 # define PRIxLEAST32 "x"
94 # define PRIxLEAST64 "lx"
96 # define PRIxFAST8 "x"
97 # define PRIxFAST16 "x"
98 # define PRIxFAST32 "x"
99 # define PRIxFAST64 "lx"
101 /* UPPERCASE hexadecimal notation. */
102 # define PRIX8 "X"
103 # define PRIX16 "X"
104 # define PRIX32 "X"
105 # define PRIX64 "lX"
107 # define PRIXLEAST8 "X"
108 # define PRIXLEAST16 "X"
109 # define PRIXLEAST32 "X"
110 # define PRIXLEAST64 "lX"
112 # define PRIXFAST8 "X"
113 # define PRIXFAST16 "X"
114 # define PRIXFAST32 "X"
115 # define PRIXFAST64 "lX"
118 /* Unsigned integers. */
119 # define PRIu8 "u"
120 # define PRIu16 "u"
121 # define PRIu32 "u"
122 # define PRIu64 "lu"
124 # define PRIuLEAST8 "u"
125 # define PRIuLEAST16 "u"
126 # define PRIuLEAST32 "u"
127 # define PRIuLEAST64 "lu"
129 # define PRIuFAST8 "u"
130 # define PRIuFAST16 "u"
131 # define PRIuFAST32 "u"
132 # define PRIuFAST64 "lu"
135 /* Macros for printing `intmax_t' and `uintmax_t'. */
136 # define PRIdMAX "ld"
137 # define PRIoMAX "lo"
138 # define PRIxMAX "lx"
139 # define PRIuMAX "lu"
142 /* Macros for printing `intptr_t' and `uintptr_t'. */
143 # define PRIdPTR "ld"
144 # define PRIoPTR "lo"
145 # define PRIxPTR "lx"
146 # define PRIuPTR "lu"
149 /* Macros for printing format specifiers. */
151 /* Decimal notation. */
152 # define SCNd8 "hhd"
153 # define SCNd16 "hd"
154 # define SCNd32 "d"
155 # define SCNd64 "ld"
157 # define SCNi8 "hhi"
158 # define SCNi16 "hi"
159 # define SCNi32 "i"
160 # define SCNi64 "li"
162 # define SCNu8 "hhu"
163 # define SCNu16 "hu"
164 # define SCNu32 "u"
165 # define SCNu64 "lu"
167 /* Octal notation. */
168 # define SCNo8 "hho"
169 # define SCNo16 "ho"
170 # define SCNo32 "o"
171 # define SCNo64 "lo"
173 /* Hexadecimal notation. */
174 # define SCNx8 "hhx"
175 # define SCNx16 "hx"
176 # define SCNx32 "x"
177 # define SCNx64 "lx"
180 /* Macros for scaning `intfast_t' and `uintfast_t'. */
181 # define SCNdFAST "ld"
182 # define SCNiFAST "li"
183 # define SCNoFAST "lo"
184 # define SCNxFAST "lx"
186 /* Macros for scaning `intptr_t' and `uintptr_t'. */
187 # define SCNdPTR "ld"
188 # define SCNiPTR "li"
189 # define SCNoPTR "lo"
190 # define SCNxPTR "lx"
192 #endif /* C++ && format macros */
195 __BEGIN_DECLS
197 /* Like `strtol' but convert to `intmax_t'. */
198 extern intmax_t strtoimax __P ((__const char *__restrict __nptr,
199 char **__restrict __endptr, int __base));
201 /* Like `strtoul' but convert to `uintmax_t'. */
202 extern uintmax_t strtoumax __P ((__const char * __restrict __nptr,
203 char ** __restrict __endptr, int __base));
205 /* Like `wcstol' but convert to `intmax_t'. */
206 extern intmax_t wcstoimax __P ((__const wchar_t * __restrict __nptr,
207 wchar_t **__restrict __endptr, int __base));
209 /* Like `wcstoul' but convert to `uintmax_t'. */
210 extern uintmax_t wcstoumax __P ((__const wchar_t * __restrict __nptr,
211 wchar_t ** __restrict __endptr, int __base));
213 #if defined __GNUC__ && __GNUC__ >= 2 && defined __OPTIMIZE__
215 /* Like `strtol' but convert to `intmax_t'. */
216 # ifndef __strtol_internal_defined
217 extern long int __strtol_internal __P ((__const char *__restrict __nptr,
218 char **__restrict __endptr,
219 int __base, int __group));
220 # define __strtol_internal_defined 1
221 # endif
222 extern __inline intmax_t
223 strtoimax (__const char *__restrict nptr, char **__restrict endptr, int base)
225 return __strtol_internal (nptr, endptr, base, 0);
228 /* Like `strtoul' but convert to `uintmax_t'. */
229 # ifndef __strtoul_internal_defined
230 extern unsigned long int __strtoul_internal __P ((__const char *
231 __restrict __nptr,
232 char ** __restrict __endptr,
233 int __base, int __group));
234 # define __strtoul_internal_defined 1
235 # endif
236 extern __inline uintmax_t
237 strtoumax (__const char *__restrict nptr, char **__restrict endptr, int base)
239 return __strtoul_internal (nptr, endptr, base, 0);
242 /* Like `wcstol' but convert to `intmax_t'. */
243 # ifndef __wcstol_internal_defined
244 extern long int __wcstol_internal __P ((__const wchar_t * __restrict __nptr,
245 wchar_t **__restrict __endptr,
246 int __base, int __group));
247 # define __wcstol_internal_defined 1
248 # endif
249 extern __inline intmax_t
250 wcstoimax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
251 int base)
253 return __wcstol_internal (nptr, endptr, base, 0);
257 /* Like `wcstoul' but convert to `uintmax_t'. */
258 # ifndef __wcstoul_internal_defined
259 extern unsigned long int __wcstoul_internal __P ((__const wchar_t *
260 __restrict __nptr,
261 wchar_t **
262 __restrict __endptr,
263 int __base, int __group));
264 # define __wcstoul_internal_defined 1
265 # endif
266 extern __inline uintmax_t
267 wcstoumax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
268 int base)
270 return __wcstoul_internal (nptr, endptr, base, 0);
272 #endif /* GCC and Optimization. */
274 __END_DECLS
276 #endif /* inttypes.h */