1*d87708c5Sjoerg /* $NetBSD: int_fmtio.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ */ 281918bf8Sfvdl 381918bf8Sfvdl /*- 481918bf8Sfvdl * Copyright (c) 2001 The NetBSD Foundation, Inc. 581918bf8Sfvdl * All rights reserved. 681918bf8Sfvdl * 781918bf8Sfvdl * This code is derived from software contributed to The NetBSD Foundation 881918bf8Sfvdl * by Klaus Klein. 981918bf8Sfvdl * 1081918bf8Sfvdl * Redistribution and use in source and binary forms, with or without 1181918bf8Sfvdl * modification, are permitted provided that the following conditions 1281918bf8Sfvdl * are met: 1381918bf8Sfvdl * 1. Redistributions of source code must retain the above copyright 1481918bf8Sfvdl * notice, this list of conditions and the following disclaimer. 1581918bf8Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 1681918bf8Sfvdl * notice, this list of conditions and the following disclaimer in the 1781918bf8Sfvdl * documentation and/or other materials provided with the distribution. 1881918bf8Sfvdl * 1981918bf8Sfvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2081918bf8Sfvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2181918bf8Sfvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2281918bf8Sfvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2381918bf8Sfvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2481918bf8Sfvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2581918bf8Sfvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2681918bf8Sfvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2781918bf8Sfvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2881918bf8Sfvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2981918bf8Sfvdl * POSSIBILITY OF SUCH DAMAGE. 3081918bf8Sfvdl */ 3181918bf8Sfvdl 3281918bf8Sfvdl #ifndef _AMD64_INT_FMTIO_H_ 3381918bf8Sfvdl #define _AMD64_INT_FMTIO_H_ 3481918bf8Sfvdl 35*d87708c5Sjoerg #ifdef __INTPTR_FMTd__ 36*d87708c5Sjoerg #include <sys/common_int_fmtio.h> 37*d87708c5Sjoerg #else 38*d87708c5Sjoerg 39433b5ddeSmrg #ifdef __x86_64__ 40433b5ddeSmrg 4181918bf8Sfvdl /* 4281918bf8Sfvdl * 7.8.1 Macros for format specifiers 4381918bf8Sfvdl */ 4481918bf8Sfvdl 4581918bf8Sfvdl /* fprintf macros for signed integers */ 4681918bf8Sfvdl 4781918bf8Sfvdl #define PRId8 "d" /* int8_t */ 4881918bf8Sfvdl #define PRId16 "d" /* int16_t */ 4981918bf8Sfvdl #define PRId32 "d" /* int32_t */ 5081918bf8Sfvdl #define PRId64 "ld" /* int64_t */ 5181918bf8Sfvdl #define PRIdLEAST8 "d" /* int_least8_t */ 5281918bf8Sfvdl #define PRIdLEAST16 "d" /* int_least16_t */ 5381918bf8Sfvdl #define PRIdLEAST32 "d" /* int_least32_t */ 5481918bf8Sfvdl #define PRIdLEAST64 "ld" /* int_least64_t */ 5581918bf8Sfvdl #define PRIdFAST8 "d" /* int_fast8_t */ 5681918bf8Sfvdl #define PRIdFAST16 "d" /* int_fast16_t */ 5781918bf8Sfvdl #define PRIdFAST32 "d" /* int_fast32_t */ 5881918bf8Sfvdl #define PRIdFAST64 "ld" /* int_fast64_t */ 5981918bf8Sfvdl #define PRIdMAX "ld" /* intmax_t */ 6081918bf8Sfvdl #define PRIdPTR "ld" /* intptr_t */ 6181918bf8Sfvdl 6281918bf8Sfvdl #define PRIi8 "i" /* int8_t */ 6381918bf8Sfvdl #define PRIi16 "i" /* int16_t */ 6481918bf8Sfvdl #define PRIi32 "i" /* int32_t */ 6581918bf8Sfvdl #define PRIi64 "li" /* int64_t */ 6681918bf8Sfvdl #define PRIiLEAST8 "i" /* int_least8_t */ 6781918bf8Sfvdl #define PRIiLEAST16 "i" /* int_least16_t */ 6881918bf8Sfvdl #define PRIiLEAST32 "i" /* int_least32_t */ 6981918bf8Sfvdl #define PRIiLEAST64 "li" /* int_least64_t */ 7081918bf8Sfvdl #define PRIiFAST8 "i" /* int_fast8_t */ 7181918bf8Sfvdl #define PRIiFAST16 "i" /* int_fast16_t */ 7281918bf8Sfvdl #define PRIiFAST32 "i" /* int_fast32_t */ 7381918bf8Sfvdl #define PRIiFAST64 "li" /* int_fast64_t */ 7481918bf8Sfvdl #define PRIiMAX "li" /* intmax_t */ 7581918bf8Sfvdl #define PRIiPTR "li" /* intptr_t */ 7681918bf8Sfvdl 7781918bf8Sfvdl /* fprintf macros for unsigned integers */ 7881918bf8Sfvdl 7981918bf8Sfvdl #define PRIo8 "o" /* uint8_t */ 8081918bf8Sfvdl #define PRIo16 "o" /* uint16_t */ 8181918bf8Sfvdl #define PRIo32 "o" /* uint32_t */ 8281918bf8Sfvdl #define PRIo64 "lo" /* uint64_t */ 8381918bf8Sfvdl #define PRIoLEAST8 "o" /* uint_least8_t */ 8481918bf8Sfvdl #define PRIoLEAST16 "o" /* uint_least16_t */ 8581918bf8Sfvdl #define PRIoLEAST32 "o" /* uint_least32_t */ 8681918bf8Sfvdl #define PRIoLEAST64 "lo" /* uint_least64_t */ 8781918bf8Sfvdl #define PRIoFAST8 "o" /* uint_fast8_t */ 8881918bf8Sfvdl #define PRIoFAST16 "o" /* uint_fast16_t */ 8981918bf8Sfvdl #define PRIoFAST32 "o" /* uint_fast32_t */ 9081918bf8Sfvdl #define PRIoFAST64 "lo" /* uint_fast64_t */ 9181918bf8Sfvdl #define PRIoMAX "lo" /* uintmax_t */ 9281918bf8Sfvdl #define PRIoPTR "lo" /* uintptr_t */ 9381918bf8Sfvdl 9481918bf8Sfvdl #define PRIu8 "u" /* uint8_t */ 9581918bf8Sfvdl #define PRIu16 "u" /* uint16_t */ 9681918bf8Sfvdl #define PRIu32 "u" /* uint32_t */ 9781918bf8Sfvdl #define PRIu64 "lu" /* uint64_t */ 9881918bf8Sfvdl #define PRIuLEAST8 "u" /* uint_least8_t */ 9981918bf8Sfvdl #define PRIuLEAST16 "u" /* uint_least16_t */ 10081918bf8Sfvdl #define PRIuLEAST32 "u" /* uint_least32_t */ 10181918bf8Sfvdl #define PRIuLEAST64 "lu" /* uint_least64_t */ 10281918bf8Sfvdl #define PRIuFAST8 "u" /* uint_fast8_t */ 10381918bf8Sfvdl #define PRIuFAST16 "u" /* uint_fast16_t */ 10481918bf8Sfvdl #define PRIuFAST32 "u" /* uint_fast32_t */ 10581918bf8Sfvdl #define PRIuFAST64 "lu" /* uint_fast64_t */ 10681918bf8Sfvdl #define PRIuMAX "lu" /* uintmax_t */ 10781918bf8Sfvdl #define PRIuPTR "lu" /* uintptr_t */ 10881918bf8Sfvdl 10981918bf8Sfvdl #define PRIx8 "x" /* uint8_t */ 11081918bf8Sfvdl #define PRIx16 "x" /* uint16_t */ 11181918bf8Sfvdl #define PRIx32 "x" /* uint32_t */ 11281918bf8Sfvdl #define PRIx64 "lx" /* uint64_t */ 11381918bf8Sfvdl #define PRIxLEAST8 "x" /* uint_least8_t */ 11481918bf8Sfvdl #define PRIxLEAST16 "x" /* uint_least16_t */ 11581918bf8Sfvdl #define PRIxLEAST32 "x" /* uint_least32_t */ 11681918bf8Sfvdl #define PRIxLEAST64 "lx" /* uint_least64_t */ 11781918bf8Sfvdl #define PRIxFAST8 "x" /* uint_fast8_t */ 11881918bf8Sfvdl #define PRIxFAST16 "x" /* uint_fast16_t */ 11981918bf8Sfvdl #define PRIxFAST32 "x" /* uint_fast32_t */ 12081918bf8Sfvdl #define PRIxFAST64 "lx" /* uint_fast64_t */ 12181918bf8Sfvdl #define PRIxMAX "lx" /* uintmax_t */ 12281918bf8Sfvdl #define PRIxPTR "lx" /* uintptr_t */ 12381918bf8Sfvdl 12481918bf8Sfvdl #define PRIX8 "X" /* uint8_t */ 12581918bf8Sfvdl #define PRIX16 "X" /* uint16_t */ 12681918bf8Sfvdl #define PRIX32 "X" /* uint32_t */ 12781918bf8Sfvdl #define PRIX64 "lX" /* uint64_t */ 12881918bf8Sfvdl #define PRIXLEAST8 "X" /* uint_least8_t */ 12981918bf8Sfvdl #define PRIXLEAST16 "X" /* uint_least16_t */ 13081918bf8Sfvdl #define PRIXLEAST32 "X" /* uint_least32_t */ 13181918bf8Sfvdl #define PRIXLEAST64 "lX" /* uint_least64_t */ 13281918bf8Sfvdl #define PRIXFAST8 "X" /* uint_fast8_t */ 13381918bf8Sfvdl #define PRIXFAST16 "X" /* uint_fast16_t */ 13481918bf8Sfvdl #define PRIXFAST32 "X" /* uint_fast32_t */ 13581918bf8Sfvdl #define PRIXFAST64 "lX" /* uint_fast64_t */ 13681918bf8Sfvdl #define PRIXMAX "lX" /* uintmax_t */ 13781918bf8Sfvdl #define PRIXPTR "lX" /* uintptr_t */ 13881918bf8Sfvdl 13981918bf8Sfvdl /* fscanf macros for signed integers */ 14081918bf8Sfvdl 14181918bf8Sfvdl #define SCNd8 "hhd" /* int8_t */ 14281918bf8Sfvdl #define SCNd16 "hd" /* int16_t */ 14381918bf8Sfvdl #define SCNd32 "d" /* int32_t */ 14481918bf8Sfvdl #define SCNd64 "ld" /* int64_t */ 14581918bf8Sfvdl #define SCNdLEAST8 "hhd" /* int_least8_t */ 14681918bf8Sfvdl #define SCNdLEAST16 "hd" /* int_least16_t */ 14781918bf8Sfvdl #define SCNdLEAST32 "d" /* int_least32_t */ 14881918bf8Sfvdl #define SCNdLEAST64 "ld" /* int_least64_t */ 1498b9e7c11Skleink #define SCNdFAST8 "d" /* int_fast8_t */ 1508b9e7c11Skleink #define SCNdFAST16 "d" /* int_fast16_t */ 15181918bf8Sfvdl #define SCNdFAST32 "d" /* int_fast32_t */ 15281918bf8Sfvdl #define SCNdFAST64 "ld" /* int_fast64_t */ 15381918bf8Sfvdl #define SCNdMAX "ld" /* intmax_t */ 15481918bf8Sfvdl #define SCNdPTR "ld" /* intptr_t */ 15581918bf8Sfvdl 15681918bf8Sfvdl #define SCNi8 "hhi" /* int8_t */ 15781918bf8Sfvdl #define SCNi16 "hi" /* int16_t */ 15881918bf8Sfvdl #define SCNi32 "i" /* int32_t */ 159e8769fc0Sfvdl #define SCNi64 "li" /* int64_t */ 16081918bf8Sfvdl #define SCNiLEAST8 "hhi" /* int_least8_t */ 16181918bf8Sfvdl #define SCNiLEAST16 "hi" /* int_least16_t */ 16281918bf8Sfvdl #define SCNiLEAST32 "i" /* int_least32_t */ 16381918bf8Sfvdl #define SCNiLEAST64 "li" /* int_least64_t */ 1648b9e7c11Skleink #define SCNiFAST8 "i" /* int_fast8_t */ 1658b9e7c11Skleink #define SCNiFAST16 "i" /* int_fast16_t */ 16681918bf8Sfvdl #define SCNiFAST32 "i" /* int_fast32_t */ 16781918bf8Sfvdl #define SCNiFAST64 "li" /* int_fast64_t */ 16881918bf8Sfvdl #define SCNiMAX "li" /* intmax_t */ 16981918bf8Sfvdl #define SCNiPTR "li" /* intptr_t */ 17081918bf8Sfvdl 17181918bf8Sfvdl /* fscanf macros for unsigned integers */ 17281918bf8Sfvdl 17381918bf8Sfvdl #define SCNo8 "hho" /* uint8_t */ 17481918bf8Sfvdl #define SCNo16 "ho" /* uint16_t */ 17581918bf8Sfvdl #define SCNo32 "o" /* uint32_t */ 17681918bf8Sfvdl #define SCNo64 "lo" /* uint64_t */ 17781918bf8Sfvdl #define SCNoLEAST8 "hho" /* uint_least8_t */ 17881918bf8Sfvdl #define SCNoLEAST16 "ho" /* uint_least16_t */ 17981918bf8Sfvdl #define SCNoLEAST32 "o" /* uint_least32_t */ 18081918bf8Sfvdl #define SCNoLEAST64 "lo" /* uint_least64_t */ 1818b9e7c11Skleink #define SCNoFAST8 "o" /* uint_fast8_t */ 1828b9e7c11Skleink #define SCNoFAST16 "o" /* uint_fast16_t */ 18381918bf8Sfvdl #define SCNoFAST32 "o" /* uint_fast32_t */ 18481918bf8Sfvdl #define SCNoFAST64 "lo" /* uint_fast64_t */ 18581918bf8Sfvdl #define SCNoMAX "lo" /* uintmax_t */ 18681918bf8Sfvdl #define SCNoPTR "lo" /* uintptr_t */ 18781918bf8Sfvdl 18881918bf8Sfvdl #define SCNu8 "hhu" /* uint8_t */ 18981918bf8Sfvdl #define SCNu16 "hu" /* uint16_t */ 19081918bf8Sfvdl #define SCNu32 "u" /* uint32_t */ 19181918bf8Sfvdl #define SCNu64 "lu" /* uint64_t */ 19281918bf8Sfvdl #define SCNuLEAST8 "hhu" /* uint_least8_t */ 19381918bf8Sfvdl #define SCNuLEAST16 "hu" /* uint_least16_t */ 19481918bf8Sfvdl #define SCNuLEAST32 "u" /* uint_least32_t */ 19581918bf8Sfvdl #define SCNuLEAST64 "lu" /* uint_least64_t */ 1968b9e7c11Skleink #define SCNuFAST8 "u" /* uint_fast8_t */ 1978b9e7c11Skleink #define SCNuFAST16 "u" /* uint_fast16_t */ 19881918bf8Sfvdl #define SCNuFAST32 "u" /* uint_fast32_t */ 19981918bf8Sfvdl #define SCNuFAST64 "lu" /* uint_fast64_t */ 20081918bf8Sfvdl #define SCNuMAX "lu" /* uintmax_t */ 20181918bf8Sfvdl #define SCNuPTR "lu" /* uintptr_t */ 20281918bf8Sfvdl 20381918bf8Sfvdl #define SCNx8 "hhx" /* uint8_t */ 20481918bf8Sfvdl #define SCNx16 "hx" /* uint16_t */ 20581918bf8Sfvdl #define SCNx32 "x" /* uint32_t */ 20681918bf8Sfvdl #define SCNx64 "lx" /* uint64_t */ 20781918bf8Sfvdl #define SCNxLEAST8 "hhx" /* uint_least8_t */ 20881918bf8Sfvdl #define SCNxLEAST16 "hx" /* uint_least16_t */ 20981918bf8Sfvdl #define SCNxLEAST32 "x" /* uint_least32_t */ 21081918bf8Sfvdl #define SCNxLEAST64 "lx" /* uint_least64_t */ 2118b9e7c11Skleink #define SCNxFAST8 "x" /* uint_fast8_t */ 2128b9e7c11Skleink #define SCNxFAST16 "x" /* uint_fast16_t */ 21381918bf8Sfvdl #define SCNxFAST32 "x" /* uint_fast32_t */ 21481918bf8Sfvdl #define SCNxFAST64 "lx" /* uint_fast64_t */ 21581918bf8Sfvdl #define SCNxMAX "lx" /* uintmax_t */ 21681918bf8Sfvdl #define SCNxPTR "lx" /* uintptr_t */ 21781918bf8Sfvdl 218433b5ddeSmrg #else /* __x86_64__ */ 219433b5ddeSmrg 220433b5ddeSmrg #include <i386/int_fmtio.h> 221433b5ddeSmrg 222433b5ddeSmrg #endif /* __x86_64__ */ 223433b5ddeSmrg 224*d87708c5Sjoerg #endif 225*d87708c5Sjoerg 22681918bf8Sfvdl #endif /* !_AMD64_INT_FMTIO_H_ */ 227