_inttypes.h revision 85892
1238106Sdes/*-
2238106Sdes * Copyright (c) 2001 The NetBSD Foundation, Inc.
3238106Sdes * All rights reserved.
4238106Sdes *
5238106Sdes * This code is derived from software contributed to The NetBSD Foundation
6238106Sdes * by Klaus Klein.
7238106Sdes *
8238106Sdes * Redistribution and use in source and binary forms, with or without
9238106Sdes * modification, are permitted provided that the following conditions
10238106Sdes * are met:
11238106Sdes * 1. Redistributions of source code must retain the above copyright
12238106Sdes *    notice, this list of conditions and the following disclaimer.
13238106Sdes * 2. Redistributions in binary form must reproduce the above copyright
14238106Sdes *    notice, this list of conditions and the following disclaimer in the
15238106Sdes *    documentation and/or other materials provided with the distribution.
16238106Sdes * 3. All advertising materials mentioning features or use of this software
17238106Sdes *    must display the following acknowledgement:
18238106Sdes *        This product includes software developed by the NetBSD
19238106Sdes *        Foundation, Inc. and its contributors.
20238106Sdes * 4. Neither the name of The NetBSD Foundation nor the names of its
21238106Sdes *    contributors may be used to endorse or promote products derived
22238106Sdes *    from this software without specific prior written permission.
23238106Sdes *
24269257Sdes * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
25269257Sdes * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26269257Sdes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27269257Sdes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28269257Sdes * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29269257Sdes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30269257Sdes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31269257Sdes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32269257Sdes * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33269257Sdes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34238106Sdes * POSSIBILITY OF SUCH DAMAGE.
35238106Sdes *
36238106Sdes *	From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $
37238106Sdes * $FreeBSD: head/sys/powerpc/include/_inttypes.h 85892 2001-11-02 18:05:43Z mike $
38238106Sdes */
39238106Sdes
40238106Sdes#ifndef _MACHINE_INTTYPES_H_
41238106Sdes#define _MACHINE_INTTYPES_H_
42238106Sdes
43238106Sdes/*
44238106Sdes * Macros for format specifiers.
45238106Sdes */
46238106Sdes
47238106Sdes/* fprintf(3) macros for signed integers. */
48238106Sdes
49269257Sdes#define	PRId8		"d"	/* int8_t */
50238106Sdes#define	PRId16		"d"	/* int16_t */
51238106Sdes#define	PRId32		"d"	/* int32_t */
52238106Sdes#define	PRId64		"lld"	/* int64_t */
53238106Sdes#define	PRIdLEAST8	"d"	/* int_least8_t */
54238106Sdes#define	PRIdLEAST16	"d"	/* int_least16_t */
55238106Sdes#define	PRIdLEAST32	"d"	/* int_least32_t */
56238106Sdes#define	PRIdLEAST64	"lld"	/* int_least64_t */
57238106Sdes#define	PRIdFAST8	"d"	/* int_fast8_t */
58238106Sdes#define	PRIdFAST16	"d"	/* int_fast16_t */
59238106Sdes#define	PRIdFAST32	"d"	/* int_fast32_t */
60238106Sdes#define	PRIdFAST64	"lld"	/* int_fast64_t */
61269257Sdes#define	PRIdMAX		"lld"	/* intmax_t */
62238106Sdes#define	PRIdPTR		"d"	/* intptr_t */
63238106Sdes
64238106Sdes#define	PRIi8		"i"	/* int8_t */
65238106Sdes#define	PRIi16		"i"	/* int16_t */
66238106Sdes#define	PRIi32		"i"	/* int32_t */
67238106Sdes#define	PRIi64		"lli"	/* int64_t */
68238106Sdes#define	PRIiLEAST8	"i"	/* int_least8_t  */
69238106Sdes#define	PRIiLEAST16	"i"	/* int_least16_t */
70238106Sdes#define	PRIiLEAST32	"i"	/* int_least32_t */
71238106Sdes#define	PRIiLEAST64	"lli"	/* int_least64_t */
72238106Sdes#define	PRIiFAST8	"i"	/* int_fast8_t */
73238106Sdes#define	PRIiFAST16	"i"	/* int_fast16_t */
74238106Sdes#define	PRIiFAST32	"i"	/* int_fast32_t */
75238106Sdes#define	PRIiFAST64	"lli"	/* int_fast64_t */
76238106Sdes#define	PRIiMAX		"lli"	/* intmax_t */
77238106Sdes#define	PRIiPTR		"i"	/* intptr_t */
78238106Sdes
79238106Sdes/* fprintf(3) macros for unsigned integers. */
80238106Sdes
81238106Sdes#define	PRIo8		"o"	/* uint8_t */
82238106Sdes#define	PRIo16		"o"	/* uint16_t */
83238106Sdes#define	PRIo32		"o"	/* uint32_t */
84238106Sdes#define	PRIo64		"llo"	/* uint64_t */
85238106Sdes#define	PRIoLEAST8	"o"	/* uint_least8_t */
86238106Sdes#define	PRIoLEAST16	"o"	/* uint_least16_t */
87238106Sdes#define	PRIoLEAST32	"o"	/* uint_least32_t */
88238106Sdes#define	PRIoLEAST64	"llo"	/* uint_least64_t */
89238106Sdes#define	PRIoFAST8	"o"	/* uint_fast8_t */
90238106Sdes#define	PRIoFAST16	"o"	/* uint_fast16_t */
91238106Sdes#define	PRIoFAST32	"o"	/* uint_fast32_t */
92238106Sdes#define	PRIoFAST64	"llo"	/* uint_fast64_t */
93238106Sdes#define	PRIoMAX		"llo"	/* uintmax_t */
94238106Sdes#define	PRIoPTR		"o"	/* uintptr_t */
95238106Sdes
96238106Sdes#define	PRIu8		"u"	/* uint8_t */
97238106Sdes#define	PRIu16		"u"	/* uint16_t */
98238106Sdes#define	PRIu32		"u"	/* uint32_t */
99238106Sdes#define	PRIu64		"llu"	/* uint64_t */
100238106Sdes#define	PRIuLEAST8	"u"	/* uint_least8_t */
101238106Sdes#define	PRIuLEAST16	"u"	/* uint_least16_t */
102238106Sdes#define	PRIuLEAST32	"u"	/* uint_least32_t */
103238106Sdes#define	PRIuLEAST64	"llu"	/* uint_least64_t */
104238106Sdes#define	PRIuFAST8	"u"	/* uint_fast8_t */
105238106Sdes#define	PRIuFAST16	"u"	/* uint_fast16_t */
106238106Sdes#define	PRIuFAST32	"u"	/* uint_fast32_t */
107238106Sdes#define	PRIuFAST64	"llu"	/* uint_fast64_t */
108238106Sdes#define	PRIuMAX		"llu"	/* uintmax_t */
109238106Sdes#define	PRIuPTR		"u"	/* uintptr_t */
110269257Sdes
111269257Sdes#define	PRIx8		"x"	/* uint8_t */
112269257Sdes#define	PRIx16		"x"	/* uint16_t */
113238106Sdes#define	PRIx32		"x"	/* uint32_t */
114238106Sdes#define	PRIx64		"llx"	/* uint64_t */
115269257Sdes#define	PRIxLEAST8	"x"	/* uint_least8_t */
116269257Sdes#define	PRIxLEAST16	"x"	/* uint_least16_t */
117238106Sdes#define	PRIxLEAST32	"x"	/* uint_least32_t */
118238106Sdes#define	PRIxLEAST64	"llx"	/* uint_least64_t */
119238106Sdes#define	PRIxFAST8	"x"	/* uint_fast8_t */
120238106Sdes#define	PRIxFAST16	"x"	/* uint_fast16_t */
121238106Sdes#define	PRIxFAST32	"x"	/* uint_fast32_t */
122238106Sdes#define	PRIxFAST64	"llx"	/* uint_fast64_t */
123238106Sdes#define	PRIxMAX		"llx"	/* uintmax_t */
124238106Sdes#define	PRIxPTR		"x"	/* uintptr_t */
125238106Sdes
126238106Sdes#define	PRIX8		"X"	/* uint8_t */
127238106Sdes#define	PRIX16		"X"	/* uint16_t */
128238106Sdes#define	PRIX32		"X"	/* uint32_t */
129238106Sdes#define	PRIX64		"llX"	/* uint64_t */
130238106Sdes#define	PRIXLEAST8	"X"	/* uint_least8_t */
131238106Sdes#define	PRIXLEAST16	"X"	/* uint_least16_t */
132285206Sdes#define	PRIXLEAST32	"X"	/* uint_least32_t */
133238106Sdes#define	PRIXLEAST64	"llX"	/* uint_least64_t */
134238106Sdes#define	PRIXFAST8	"X"	/* uint_fast8_t */
135238106Sdes#define	PRIXFAST16	"X"	/* uint_fast16_t */
136238106Sdes#define	PRIXFAST32	"X"	/* uint_fast32_t */
137238106Sdes#define	PRIXFAST64	"llX"	/* uint_fast64_t */
138238106Sdes#define	PRIXMAX		"llX"	/* uintmax_t */
139238106Sdes#define	PRIXPTR		"X"	/* uintptr_t */
140285206Sdes
141285206Sdes/* fscanf(3) macros for signed integers. */
142238106Sdes
143238106Sdes#define	SCNd8		"hhd"	/* int8_t */
144238106Sdes#define	SCNd16		"hd"	/* int16_t */
145238106Sdes#define	SCNd32		"d"	/* int32_t */
146238106Sdes#define	SCNd64		"lld"	/* int64_t */
147238106Sdes#define	SCNdLEAST8	"hhd"	/* int_least8_t */
148238106Sdes#define	SCNdLEAST16	"hd"	/* int_least16_t */
149238106Sdes#define	SCNdLEAST32	"d"	/* int_least32_t */
150238106Sdes#define	SCNdLEAST64	"lld"	/* int_least64_t */
151238106Sdes#define	SCNdFAST8	"d"	/* int_fast8_t */
152238106Sdes#define	SCNdFAST16	"d"	/* int_fast16_t */
153238106Sdes#define	SCNdFAST32	"d"	/* int_fast32_t */
154238106Sdes#define	SCNdFAST64	"lld"	/* int_fast64_t */
155238106Sdes#define	SCNdMAX		"lld"	/* intmax_t */
156238106Sdes#define	SCNdPTR		"d"	/* intptr_t */
157238106Sdes
158238106Sdes#define	SCNi8		"hhi"	/* int8_t */
159238106Sdes#define	SCNi16		"hi"	/* int16_t */
160238106Sdes#define	SCNi32		"i"	/* int32_t */
161238106Sdes#define	SCNi64		"lli"	/* int64_t */
162238106Sdes#define	SCNiLEAST8	"hhi"	/* int_least8_t */
163238106Sdes#define	SCNiLEAST16	"hi"	/* int_least16_t */
164238106Sdes#define	SCNiLEAST32	"i"	/* int_least32_t */
165238106Sdes#define	SCNiLEAST64	"lli"	/* int_least64_t */
166238106Sdes#define	SCNiFAST8	"i"	/* int_fast8_t */
167238106Sdes#define	SCNiFAST16	"i"	/* int_fast16_t */
168238106Sdes#define	SCNiFAST32	"i"	/* int_fast32_t */
169238106Sdes#define	SCNiFAST64	"lli"	/* int_fast64_t */
170238106Sdes#define	SCNiMAX		"lli"	/* intmax_t */
171238106Sdes#define	SCNiPTR		"i"	/* intptr_t */
172238106Sdes
173238106Sdes/* fscanf(3) macros for unsigned integers. */
174238106Sdes
175238106Sdes#define	SCNo8		"hho"	/* uint8_t */
176238106Sdes#define	SCNo16		"ho"	/* uint16_t */
177238106Sdes#define	SCNo32		"o"	/* uint32_t */
178238106Sdes#define	SCNo64		"llo"	/* uint64_t */
179238106Sdes#define	SCNoLEAST8	"hho"	/* uint_least8_t */
180238106Sdes#define	SCNoLEAST16	"ho"	/* uint_least16_t */
181238106Sdes#define	SCNoLEAST32	"o"	/* uint_least32_t */
182238106Sdes#define	SCNoLEAST64	"llo"	/* uint_least64_t */
183238106Sdes#define	SCNoFAST8	"o"	/* uint_fast8_t */
184238106Sdes#define	SCNoFAST16	"o"	/* uint_fast16_t */
185238106Sdes#define	SCNoFAST32	"o"	/* uint_fast32_t */
186238106Sdes#define	SCNoFAST64	"llo"	/* uint_fast64_t */
187238106Sdes#define	SCNoMAX		"llo"	/* uintmax_t */
188269257Sdes#define	SCNoPTR		"o"	/* uintptr_t */
189269257Sdes
190269257Sdes#define	SCNu8		"hhu"	/* uint8_t */
191269257Sdes#define	SCNu16		"hu"	/* uint16_t */
192291767Sdes#define	SCNu32		"u"	/* uint32_t */
193238106Sdes#define	SCNu64		"llu"	/* uint64_t */
194238106Sdes#define	SCNuLEAST8	"hhu"	/* uint_least8_t */
195238106Sdes#define	SCNuLEAST16	"hu"	/* uint_least16_t */
196238106Sdes#define	SCNuLEAST32	"u"	/* uint_least32_t */
197291767Sdes#define	SCNuLEAST64	"llu"	/* uint_least64_t */
198238106Sdes#define	SCNuFAST8	"u"	/* uint_fast8_t */
199238106Sdes#define	SCNuFAST16	"u"	/* uint_fast16_t */
200238106Sdes#define	SCNuFAST32	"u"	/* uint_fast32_t */
201238106Sdes#define	SCNuFAST64	"llu"	/* uint_fast64_t */
202238106Sdes#define	SCNuMAX		"llu"	/* uintmax_t */
203238106Sdes#define	SCNuPTR		"u"	/* uintptr_t */
204269257Sdes
205269257Sdes#define	SCNx8		"hhx"	/* uint8_t */
206291767Sdes#define	SCNx16		"hx"	/* uint16_t */
207238106Sdes#define	SCNx32		"x"	/* uint32_t */
208238106Sdes#define	SCNx64		"llx"	/* uint64_t */
209269257Sdes#define	SCNxLEAST8	"hhx"	/* uint_least8_t */
210291767Sdes#define	SCNxLEAST16	"hx"	/* uint_least16_t */
211238106Sdes#define	SCNxLEAST32	"x"	/* uint_least32_t */
212285206Sdes#define	SCNxLEAST64	"llx"	/* uint_least64_t */
213285206Sdes#define	SCNxFAST8	"x"	/* uint_fast8_t */
214285206Sdes#define	SCNxFAST16	"x"	/* uint_fast16_t */
215285206Sdes#define	SCNxFAST32	"x"	/* uint_fast32_t */
216285206Sdes#define	SCNxFAST64	"llx"	/* uint_fast64_t */
217285206Sdes#define	SCNxMAX		"llx"	/* uintmax_t */
218285206Sdes#define	SCNxPTR		"x"	/* uintptr_t */
219285206Sdes
220285206Sdes#endif /* !_MACHINE_INTTYPES_H_ */
221238106Sdes