1 /*****************************************************************************/
5 /* Format conversion of integer types */
9 /* (C) 2002-2009, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
36 /* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks
37 * a 64 bit data types and is not able to return structs > 4 bytes. The
38 * declarations have been adjusted accordingly or left out.
48 /* inttypes.h must always include stdint.h */
55 /* Return type of the imaxdiv function (which currently doesn't exist) */
62 /* Standard functions */
63 intmax_t __fastcall__ imaxabs (intmax_t val);
64 intmax_t __fastcall__ strtoimax (const char* nptr, char** endptr, int base);
65 uintmax_t __fastcall__ strtoumax (const char* nptr, char** endptr, int base);
69 /* printf() macros for signed integers */
74 #define PRIdLEAST8 "d"
75 #define PRIdLEAST16 "d"
76 #define PRIdLEAST32 "ld"
79 #define PRIdFAST16 "d"
80 #define PRIdFAST32 "ld"
89 #define PRIiLEAST8 "i"
90 #define PRIiLEAST16 "i"
91 #define PRIiLEAST32 "li"
94 #define PRIiFAST16 "i"
95 #define PRIiFAST32 "li"
100 /* fprintf() macros for unsigned integers */
105 #define PRIoLEAST8 "o"
106 #define PRIoLEAST16 "o"
107 #define PRIoLEAST32 "lo"
109 #define PRIoFAST8 "o"
110 #define PRIoFAST16 "o"
111 #define PRIoFAST32 "lo"
120 #define PRIuLEAST8 "u"
121 #define PRIuLEAST16 "u"
122 #define PRIuLEAST32 "lu"
124 #define PRIuFAST8 "u"
125 #define PRIuFAST16 "u"
126 #define PRIuFAST32 "lu"
135 #define PRIxLEAST8 "x"
136 #define PRIxLEAST16 "x"
137 #define PRIxLEAST32 "lx"
139 #define PRIxFAST8 "x"
140 #define PRIxFAST16 "x"
141 #define PRIxFAST32 "lx"
150 #define PRIXLEAST8 "X"
151 #define PRIXLEAST16 "X"
152 #define PRIXLEAST32 "lX"
154 #define PRIXFAST8 "X"
155 #define PRIXFAST16 "X"
156 #define PRIXFAST32 "lX"
161 /* fscanf() macros for signed integers */
166 #define SCNdLEAST8 "hd"
167 #define SCNdLEAST16 "d"
168 #define SCNdLEAST32 "ld"
170 #define SCNdFAST8 "hd"
171 #define SCNdFAST16 "d"
172 #define SCNdFAST32 "ld"
181 #define SCNiLEAST8 "hi"
182 #define SCNiLEAST16 "i"
183 #define SCNiLEAST32 "li"
185 #define SCNiFAST8 "hi"
186 #define SCNiFAST16 "i"
187 #define SCNiFAST32 "li"
192 /* fscanf() macros for unsigned integers */
197 #define SCNoLEAST8 "ho"
198 #define SCNoLEAST16 "o"
199 #define SCNoLEAST32 "lo"
201 #define SCNoFAST8 "ho"
202 #define SCNoFAST16 "o"
203 #define SCNoFAST32 "lo"
212 #define SCNuLEAST8 "hu"
213 #define SCNuLEAST16 "u"
214 #define SCNuLEAST32 "lu"
216 #define SCNuFAST8 "hu"
217 #define SCNuFAST16 "u"
218 #define SCNuFAST32 "lu"
227 #define SCNxLEAST8 "hx"
228 #define SCNxLEAST16 "x"
229 #define SCNxLEAST32 "lx"
231 #define SCNxFAST8 "hx"
232 #define SCNxFAST16 "x"
233 #define SCNxFAST32 "lx"
240 /* End of inttypes.h */