1*0a6a1f1dSLionel Sambuc /* $NetBSD: int_fmtio.h,v 1.9 2014/07/28 11:22:46 joerg Exp $ */ 2f6aac1c3SLionel Sambuc 3f6aac1c3SLionel Sambuc /*- 4f6aac1c3SLionel Sambuc * Copyright (c) 2001 The NetBSD Foundation, Inc. 5f6aac1c3SLionel Sambuc * All rights reserved. 6f6aac1c3SLionel Sambuc * 7f6aac1c3SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 8f6aac1c3SLionel Sambuc * by Klaus Klein. 9f6aac1c3SLionel Sambuc * 10f6aac1c3SLionel Sambuc * Redistribution and use in source and binary forms, with or without 11f6aac1c3SLionel Sambuc * modification, are permitted provided that the following conditions 12f6aac1c3SLionel Sambuc * are met: 13f6aac1c3SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 14f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer. 15f6aac1c3SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 16f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 17f6aac1c3SLionel Sambuc * documentation and/or other materials provided with the distribution. 18f6aac1c3SLionel Sambuc * 19f6aac1c3SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20f6aac1c3SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21f6aac1c3SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22f6aac1c3SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23f6aac1c3SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24f6aac1c3SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25f6aac1c3SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26f6aac1c3SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27f6aac1c3SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28f6aac1c3SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29f6aac1c3SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 30f6aac1c3SLionel Sambuc */ 31f6aac1c3SLionel Sambuc 32f6aac1c3SLionel Sambuc #ifndef _I386_INT_FMTIO_H_ 33f6aac1c3SLionel Sambuc #define _I386_INT_FMTIO_H_ 34f6aac1c3SLionel Sambuc 35*0a6a1f1dSLionel Sambuc #ifdef __INTPTR_FMTd__ 36*0a6a1f1dSLionel Sambuc #include <sys/common_int_fmtio.h> 37*0a6a1f1dSLionel Sambuc #else 38*0a6a1f1dSLionel Sambuc 39f6aac1c3SLionel Sambuc /* 40f6aac1c3SLionel Sambuc * 7.8.1 Macros for format specifiers 41f6aac1c3SLionel Sambuc */ 42f6aac1c3SLionel Sambuc 43f6aac1c3SLionel Sambuc /* fprintf macros for signed integers */ 44f6aac1c3SLionel Sambuc 45f6aac1c3SLionel Sambuc #define PRId8 "d" /* int8_t */ 46f6aac1c3SLionel Sambuc #define PRId16 "d" /* int16_t */ 47f6aac1c3SLionel Sambuc #define PRId32 "d" /* int32_t */ 48f6aac1c3SLionel Sambuc #define PRId64 "lld" /* int64_t */ 49f6aac1c3SLionel Sambuc #define PRIdLEAST8 "d" /* int_least8_t */ 50f6aac1c3SLionel Sambuc #define PRIdLEAST16 "d" /* int_least16_t */ 51f6aac1c3SLionel Sambuc #define PRIdLEAST32 "d" /* int_least32_t */ 52f6aac1c3SLionel Sambuc #define PRIdLEAST64 "lld" /* int_least64_t */ 53f6aac1c3SLionel Sambuc #define PRIdFAST8 "d" /* int_fast8_t */ 54f6aac1c3SLionel Sambuc #define PRIdFAST16 "d" /* int_fast16_t */ 55f6aac1c3SLionel Sambuc #define PRIdFAST32 "d" /* int_fast32_t */ 56f6aac1c3SLionel Sambuc #define PRIdFAST64 "lld" /* int_fast64_t */ 57f6aac1c3SLionel Sambuc #define PRIdMAX "lld" /* intmax_t */ 58f6aac1c3SLionel Sambuc #define PRIdPTR "d" /* intptr_t */ 59f6aac1c3SLionel Sambuc 60f6aac1c3SLionel Sambuc #define PRIi8 "i" /* int8_t */ 61f6aac1c3SLionel Sambuc #define PRIi16 "i" /* int16_t */ 62f6aac1c3SLionel Sambuc #define PRIi32 "i" /* int32_t */ 63f6aac1c3SLionel Sambuc #define PRIi64 "lli" /* int64_t */ 64f6aac1c3SLionel Sambuc #define PRIiLEAST8 "i" /* int_least8_t */ 65f6aac1c3SLionel Sambuc #define PRIiLEAST16 "i" /* int_least16_t */ 66f6aac1c3SLionel Sambuc #define PRIiLEAST32 "i" /* int_least32_t */ 67f6aac1c3SLionel Sambuc #define PRIiLEAST64 "lli" /* int_least64_t */ 68f6aac1c3SLionel Sambuc #define PRIiFAST8 "i" /* int_fast8_t */ 69f6aac1c3SLionel Sambuc #define PRIiFAST16 "i" /* int_fast16_t */ 70f6aac1c3SLionel Sambuc #define PRIiFAST32 "i" /* int_fast32_t */ 71f6aac1c3SLionel Sambuc #define PRIiFAST64 "lli" /* int_fast64_t */ 72f6aac1c3SLionel Sambuc #define PRIiMAX "lli" /* intmax_t */ 73f6aac1c3SLionel Sambuc #define PRIiPTR "i" /* intptr_t */ 74f6aac1c3SLionel Sambuc 75f6aac1c3SLionel Sambuc /* fprintf macros for unsigned integers */ 76f6aac1c3SLionel Sambuc 77f6aac1c3SLionel Sambuc #define PRIo8 "o" /* uint8_t */ 78f6aac1c3SLionel Sambuc #define PRIo16 "o" /* uint16_t */ 79f6aac1c3SLionel Sambuc #define PRIo32 "o" /* uint32_t */ 80f6aac1c3SLionel Sambuc #define PRIo64 "llo" /* uint64_t */ 81f6aac1c3SLionel Sambuc #define PRIoLEAST8 "o" /* uint_least8_t */ 82f6aac1c3SLionel Sambuc #define PRIoLEAST16 "o" /* uint_least16_t */ 83f6aac1c3SLionel Sambuc #define PRIoLEAST32 "o" /* uint_least32_t */ 84f6aac1c3SLionel Sambuc #define PRIoLEAST64 "llo" /* uint_least64_t */ 85f6aac1c3SLionel Sambuc #define PRIoFAST8 "o" /* uint_fast8_t */ 86f6aac1c3SLionel Sambuc #define PRIoFAST16 "o" /* uint_fast16_t */ 87f6aac1c3SLionel Sambuc #define PRIoFAST32 "o" /* uint_fast32_t */ 88f6aac1c3SLionel Sambuc #define PRIoFAST64 "llo" /* uint_fast64_t */ 89f6aac1c3SLionel Sambuc #define PRIoMAX "llo" /* uintmax_t */ 90f6aac1c3SLionel Sambuc #define PRIoPTR "o" /* uintptr_t */ 91f6aac1c3SLionel Sambuc 92f6aac1c3SLionel Sambuc #define PRIu8 "u" /* uint8_t */ 93f6aac1c3SLionel Sambuc #define PRIu16 "u" /* uint16_t */ 94f6aac1c3SLionel Sambuc #define PRIu32 "u" /* uint32_t */ 95f6aac1c3SLionel Sambuc #define PRIu64 "llu" /* uint64_t */ 96f6aac1c3SLionel Sambuc #define PRIuLEAST8 "u" /* uint_least8_t */ 97f6aac1c3SLionel Sambuc #define PRIuLEAST16 "u" /* uint_least16_t */ 98f6aac1c3SLionel Sambuc #define PRIuLEAST32 "u" /* uint_least32_t */ 99f6aac1c3SLionel Sambuc #define PRIuLEAST64 "llu" /* uint_least64_t */ 100f6aac1c3SLionel Sambuc #define PRIuFAST8 "u" /* uint_fast8_t */ 101f6aac1c3SLionel Sambuc #define PRIuFAST16 "u" /* uint_fast16_t */ 102f6aac1c3SLionel Sambuc #define PRIuFAST32 "u" /* uint_fast32_t */ 103f6aac1c3SLionel Sambuc #define PRIuFAST64 "llu" /* uint_fast64_t */ 104f6aac1c3SLionel Sambuc #define PRIuMAX "llu" /* uintmax_t */ 105f6aac1c3SLionel Sambuc #define PRIuPTR "u" /* uintptr_t */ 106f6aac1c3SLionel Sambuc 107f6aac1c3SLionel Sambuc #define PRIx8 "x" /* uint8_t */ 108f6aac1c3SLionel Sambuc #define PRIx16 "x" /* uint16_t */ 109f6aac1c3SLionel Sambuc #define PRIx32 "x" /* uint32_t */ 110f6aac1c3SLionel Sambuc #define PRIx64 "llx" /* uint64_t */ 111f6aac1c3SLionel Sambuc #define PRIxLEAST8 "x" /* uint_least8_t */ 112f6aac1c3SLionel Sambuc #define PRIxLEAST16 "x" /* uint_least16_t */ 113f6aac1c3SLionel Sambuc #define PRIxLEAST32 "x" /* uint_least32_t */ 114f6aac1c3SLionel Sambuc #define PRIxLEAST64 "llx" /* uint_least64_t */ 115f6aac1c3SLionel Sambuc #define PRIxFAST8 "x" /* uint_fast8_t */ 116f6aac1c3SLionel Sambuc #define PRIxFAST16 "x" /* uint_fast16_t */ 117f6aac1c3SLionel Sambuc #define PRIxFAST32 "x" /* uint_fast32_t */ 118f6aac1c3SLionel Sambuc #define PRIxFAST64 "llx" /* uint_fast64_t */ 119f6aac1c3SLionel Sambuc #define PRIxMAX "llx" /* uintmax_t */ 120f6aac1c3SLionel Sambuc #define PRIxPTR "x" /* uintptr_t */ 121f6aac1c3SLionel Sambuc 122f6aac1c3SLionel Sambuc #define PRIX8 "X" /* uint8_t */ 123f6aac1c3SLionel Sambuc #define PRIX16 "X" /* uint16_t */ 124f6aac1c3SLionel Sambuc #define PRIX32 "X" /* uint32_t */ 125f6aac1c3SLionel Sambuc #define PRIX64 "llX" /* uint64_t */ 126f6aac1c3SLionel Sambuc #define PRIXLEAST8 "X" /* uint_least8_t */ 127f6aac1c3SLionel Sambuc #define PRIXLEAST16 "X" /* uint_least16_t */ 128f6aac1c3SLionel Sambuc #define PRIXLEAST32 "X" /* uint_least32_t */ 129f6aac1c3SLionel Sambuc #define PRIXLEAST64 "llX" /* uint_least64_t */ 130f6aac1c3SLionel Sambuc #define PRIXFAST8 "X" /* uint_fast8_t */ 131f6aac1c3SLionel Sambuc #define PRIXFAST16 "X" /* uint_fast16_t */ 132f6aac1c3SLionel Sambuc #define PRIXFAST32 "X" /* uint_fast32_t */ 133f6aac1c3SLionel Sambuc #define PRIXFAST64 "llX" /* uint_fast64_t */ 134f6aac1c3SLionel Sambuc #define PRIXMAX "llX" /* uintmax_t */ 135f6aac1c3SLionel Sambuc #define PRIXPTR "X" /* uintptr_t */ 136f6aac1c3SLionel Sambuc 137f6aac1c3SLionel Sambuc /* fscanf macros for signed integers */ 138f6aac1c3SLionel Sambuc 139f6aac1c3SLionel Sambuc #define SCNd8 "hhd" /* int8_t */ 140f6aac1c3SLionel Sambuc #define SCNd16 "hd" /* int16_t */ 141f6aac1c3SLionel Sambuc #define SCNd32 "d" /* int32_t */ 142f6aac1c3SLionel Sambuc #define SCNd64 "lld" /* int64_t */ 143f6aac1c3SLionel Sambuc #define SCNdLEAST8 "hhd" /* int_least8_t */ 144f6aac1c3SLionel Sambuc #define SCNdLEAST16 "hd" /* int_least16_t */ 145f6aac1c3SLionel Sambuc #define SCNdLEAST32 "d" /* int_least32_t */ 146f6aac1c3SLionel Sambuc #define SCNdLEAST64 "lld" /* int_least64_t */ 147*0a6a1f1dSLionel Sambuc #define SCNdFAST8 "d" /* int_fast8_t */ 148f6aac1c3SLionel Sambuc #define SCNdFAST16 "d" /* int_fast16_t */ 149f6aac1c3SLionel Sambuc #define SCNdFAST32 "d" /* int_fast32_t */ 150f6aac1c3SLionel Sambuc #define SCNdFAST64 "lld" /* int_fast64_t */ 151f6aac1c3SLionel Sambuc #define SCNdMAX "lld" /* intmax_t */ 152f6aac1c3SLionel Sambuc #define SCNdPTR "d" /* intptr_t */ 153f6aac1c3SLionel Sambuc 154f6aac1c3SLionel Sambuc #define SCNi8 "hhi" /* int8_t */ 155f6aac1c3SLionel Sambuc #define SCNi16 "hi" /* int16_t */ 156f6aac1c3SLionel Sambuc #define SCNi32 "i" /* int32_t */ 157f6aac1c3SLionel Sambuc #define SCNi64 "lli" /* int64_t */ 158f6aac1c3SLionel Sambuc #define SCNiLEAST8 "hhi" /* int_least8_t */ 159f6aac1c3SLionel Sambuc #define SCNiLEAST16 "hi" /* int_least16_t */ 160f6aac1c3SLionel Sambuc #define SCNiLEAST32 "i" /* int_least32_t */ 161f6aac1c3SLionel Sambuc #define SCNiLEAST64 "lli" /* int_least64_t */ 162*0a6a1f1dSLionel Sambuc #define SCNiFAST8 "i" /* int_fast8_t */ 163f6aac1c3SLionel Sambuc #define SCNiFAST16 "i" /* int_fast16_t */ 164f6aac1c3SLionel Sambuc #define SCNiFAST32 "i" /* int_fast32_t */ 165f6aac1c3SLionel Sambuc #define SCNiFAST64 "lli" /* int_fast64_t */ 166f6aac1c3SLionel Sambuc #define SCNiMAX "lli" /* intmax_t */ 167f6aac1c3SLionel Sambuc #define SCNiPTR "i" /* intptr_t */ 168f6aac1c3SLionel Sambuc 169f6aac1c3SLionel Sambuc /* fscanf macros for unsigned integers */ 170f6aac1c3SLionel Sambuc 171f6aac1c3SLionel Sambuc #define SCNo8 "hho" /* uint8_t */ 172f6aac1c3SLionel Sambuc #define SCNo16 "ho" /* uint16_t */ 173f6aac1c3SLionel Sambuc #define SCNo32 "o" /* uint32_t */ 174f6aac1c3SLionel Sambuc #define SCNo64 "llo" /* uint64_t */ 175f6aac1c3SLionel Sambuc #define SCNoLEAST8 "hho" /* uint_least8_t */ 176f6aac1c3SLionel Sambuc #define SCNoLEAST16 "ho" /* uint_least16_t */ 177f6aac1c3SLionel Sambuc #define SCNoLEAST32 "o" /* uint_least32_t */ 178f6aac1c3SLionel Sambuc #define SCNoLEAST64 "llo" /* uint_least64_t */ 179*0a6a1f1dSLionel Sambuc #define SCNoFAST8 "o" /* uint_fast8_t */ 180f6aac1c3SLionel Sambuc #define SCNoFAST16 "o" /* uint_fast16_t */ 181f6aac1c3SLionel Sambuc #define SCNoFAST32 "o" /* uint_fast32_t */ 182f6aac1c3SLionel Sambuc #define SCNoFAST64 "llo" /* uint_fast64_t */ 183f6aac1c3SLionel Sambuc #define SCNoMAX "llo" /* uintmax_t */ 184f6aac1c3SLionel Sambuc #define SCNoPTR "o" /* uintptr_t */ 185f6aac1c3SLionel Sambuc 186f6aac1c3SLionel Sambuc #define SCNu8 "hhu" /* uint8_t */ 187f6aac1c3SLionel Sambuc #define SCNu16 "hu" /* uint16_t */ 188f6aac1c3SLionel Sambuc #define SCNu32 "u" /* uint32_t */ 189f6aac1c3SLionel Sambuc #define SCNu64 "llu" /* uint64_t */ 190f6aac1c3SLionel Sambuc #define SCNuLEAST8 "hhu" /* uint_least8_t */ 191f6aac1c3SLionel Sambuc #define SCNuLEAST16 "hu" /* uint_least16_t */ 192f6aac1c3SLionel Sambuc #define SCNuLEAST32 "u" /* uint_least32_t */ 193f6aac1c3SLionel Sambuc #define SCNuLEAST64 "llu" /* uint_least64_t */ 194*0a6a1f1dSLionel Sambuc #define SCNuFAST8 "u" /* uint_fast8_t */ 195f6aac1c3SLionel Sambuc #define SCNuFAST16 "u" /* uint_fast16_t */ 196f6aac1c3SLionel Sambuc #define SCNuFAST32 "u" /* uint_fast32_t */ 197f6aac1c3SLionel Sambuc #define SCNuFAST64 "llu" /* uint_fast64_t */ 198f6aac1c3SLionel Sambuc #define SCNuMAX "llu" /* uintmax_t */ 199f6aac1c3SLionel Sambuc #define SCNuPTR "u" /* uintptr_t */ 200f6aac1c3SLionel Sambuc 201f6aac1c3SLionel Sambuc #define SCNx8 "hhx" /* uint8_t */ 202f6aac1c3SLionel Sambuc #define SCNx16 "hx" /* uint16_t */ 203f6aac1c3SLionel Sambuc #define SCNx32 "x" /* uint32_t */ 204f6aac1c3SLionel Sambuc #define SCNx64 "llx" /* uint64_t */ 205f6aac1c3SLionel Sambuc #define SCNxLEAST8 "hhx" /* uint_least8_t */ 206f6aac1c3SLionel Sambuc #define SCNxLEAST16 "hx" /* uint_least16_t */ 207f6aac1c3SLionel Sambuc #define SCNxLEAST32 "x" /* uint_least32_t */ 208f6aac1c3SLionel Sambuc #define SCNxLEAST64 "llx" /* uint_least64_t */ 209*0a6a1f1dSLionel Sambuc #define SCNxFAST8 "x" /* uint_fast8_t */ 210f6aac1c3SLionel Sambuc #define SCNxFAST16 "x" /* uint_fast16_t */ 211f6aac1c3SLionel Sambuc #define SCNxFAST32 "x" /* uint_fast32_t */ 212f6aac1c3SLionel Sambuc #define SCNxFAST64 "llx" /* uint_fast64_t */ 213f6aac1c3SLionel Sambuc #define SCNxMAX "llx" /* uintmax_t */ 214f6aac1c3SLionel Sambuc #define SCNxPTR "x" /* uintptr_t */ 215f6aac1c3SLionel Sambuc 216*0a6a1f1dSLionel Sambuc #endif 217*0a6a1f1dSLionel Sambuc 218f6aac1c3SLionel Sambuc #endif /* !_I386_INT_FMTIO_H_ */ 219