_inttypes.h revision 217156
185892Smike/*- 285892Smike * Copyright (c) 2001 The NetBSD Foundation, Inc. 385892Smike * All rights reserved. 485892Smike * 585892Smike * This code is derived from software contributed to The NetBSD Foundation 685892Smike * by Klaus Klein. 785892Smike * 885892Smike * Redistribution and use in source and binary forms, with or without 985892Smike * modification, are permitted provided that the following conditions 1085892Smike * are met: 1185892Smike * 1. Redistributions of source code must retain the above copyright 1285892Smike * notice, this list of conditions and the following disclaimer. 1385892Smike * 2. Redistributions in binary form must reproduce the above copyright 1485892Smike * notice, this list of conditions and the following disclaimer in the 1585892Smike * documentation and/or other materials provided with the distribution. 1685892Smike * 1785892Smike * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1885892Smike * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1985892Smike * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2085892Smike * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2185892Smike * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2285892Smike * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2385892Smike * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2485892Smike * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2585892Smike * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2685892Smike * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2785892Smike * POSSIBILITY OF SUCH DAMAGE. 2885892Smike * 2985892Smike * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ 3085892Smike * $FreeBSD: head/sys/powerpc/include/_inttypes.h 217156 2011-01-08 18:02:46Z tijl $ 3185892Smike */ 3285892Smike 3385892Smike#ifndef _MACHINE_INTTYPES_H_ 34217156Stijl#define _MACHINE_INTTYPES_H_ 3585892Smike 3685892Smike/* 3785892Smike * Macros for format specifiers. 3885892Smike */ 3985892Smike 40217147Stijl#ifdef __LP64__ 41217155Stijl#define __PRI64 "l" 42217155Stijl#define __PRIptr "l" 43209975Snwhitehorn#else 44217155Stijl#define __PRI64 "ll" 45217155Stijl#define __PRIptr 46209975Snwhitehorn#endif 47209975Snwhitehorn 4885892Smike/* fprintf(3) macros for signed integers. */ 4985892Smike 50217156Stijl#define PRId8 "d" /* int8_t */ 51217156Stijl#define PRId16 "d" /* int16_t */ 52217156Stijl#define PRId32 "d" /* int32_t */ 53217155Stijl#define PRId64 __PRI64"d" /* int64_t */ 54217156Stijl#define PRIdLEAST8 "d" /* int_least8_t */ 55217156Stijl#define PRIdLEAST16 "d" /* int_least16_t */ 56217156Stijl#define PRIdLEAST32 "d" /* int_least32_t */ 57217155Stijl#define PRIdLEAST64 __PRI64"d" /* int_least64_t */ 58217156Stijl#define PRIdFAST8 "d" /* int_fast8_t */ 59217156Stijl#define PRIdFAST16 "d" /* int_fast16_t */ 60217156Stijl#define PRIdFAST32 "d" /* int_fast32_t */ 61217155Stijl#define PRIdFAST64 __PRI64"d" /* int_fast64_t */ 62217156Stijl#define PRIdMAX "jd" /* intmax_t */ 63217155Stijl#define PRIdPTR __PRIptr"d" /* intptr_t */ 6485892Smike 65217156Stijl#define PRIi8 "i" /* int8_t */ 66217156Stijl#define PRIi16 "i" /* int16_t */ 67217156Stijl#define PRIi32 "i" /* int32_t */ 68217155Stijl#define PRIi64 __PRI64"i" /* int64_t */ 69217156Stijl#define PRIiLEAST8 "i" /* int_least8_t */ 70217156Stijl#define PRIiLEAST16 "i" /* int_least16_t */ 71217156Stijl#define PRIiLEAST32 "i" /* int_least32_t */ 72217155Stijl#define PRIiLEAST64 __PRI64"i" /* int_least64_t */ 73217156Stijl#define PRIiFAST8 "i" /* int_fast8_t */ 74217156Stijl#define PRIiFAST16 "i" /* int_fast16_t */ 75217156Stijl#define PRIiFAST32 "i" /* int_fast32_t */ 76217155Stijl#define PRIiFAST64 __PRI64"i" /* int_fast64_t */ 77217156Stijl#define PRIiMAX "ji" /* intmax_t */ 78217155Stijl#define PRIiPTR __PRIptr"i" /* intptr_t */ 7985892Smike 8085892Smike/* fprintf(3) macros for unsigned integers. */ 8185892Smike 82217156Stijl#define PRIo8 "o" /* uint8_t */ 83217156Stijl#define PRIo16 "o" /* uint16_t */ 84217156Stijl#define PRIo32 "o" /* uint32_t */ 85217155Stijl#define PRIo64 __PRI64"o" /* uint64_t */ 86217156Stijl#define PRIoLEAST8 "o" /* uint_least8_t */ 87217156Stijl#define PRIoLEAST16 "o" /* uint_least16_t */ 88217156Stijl#define PRIoLEAST32 "o" /* uint_least32_t */ 89217155Stijl#define PRIoLEAST64 __PRI64"o" /* uint_least64_t */ 90217156Stijl#define PRIoFAST8 "o" /* uint_fast8_t */ 91217156Stijl#define PRIoFAST16 "o" /* uint_fast16_t */ 92217156Stijl#define PRIoFAST32 "o" /* uint_fast32_t */ 93217155Stijl#define PRIoFAST64 __PRI64"o" /* uint_fast64_t */ 94217156Stijl#define PRIoMAX "jo" /* uintmax_t */ 95217155Stijl#define PRIoPTR __PRIptr"o" /* uintptr_t */ 9685892Smike 97217156Stijl#define PRIu8 "u" /* uint8_t */ 98217156Stijl#define PRIu16 "u" /* uint16_t */ 99217156Stijl#define PRIu32 "u" /* uint32_t */ 100217155Stijl#define PRIu64 __PRI64"u" /* uint64_t */ 101217156Stijl#define PRIuLEAST8 "u" /* uint_least8_t */ 102217156Stijl#define PRIuLEAST16 "u" /* uint_least16_t */ 103217156Stijl#define PRIuLEAST32 "u" /* uint_least32_t */ 104217155Stijl#define PRIuLEAST64 __PRI64"u" /* uint_least64_t */ 105217156Stijl#define PRIuFAST8 "u" /* uint_fast8_t */ 106217156Stijl#define PRIuFAST16 "u" /* uint_fast16_t */ 107217156Stijl#define PRIuFAST32 "u" /* uint_fast32_t */ 108217155Stijl#define PRIuFAST64 __PRI64"u" /* uint_fast64_t */ 109217156Stijl#define PRIuMAX "ju" /* uintmax_t */ 110217155Stijl#define PRIuPTR __PRIptr"u" /* uintptr_t */ 11185892Smike 112217156Stijl#define PRIx8 "x" /* uint8_t */ 113217156Stijl#define PRIx16 "x" /* uint16_t */ 114217156Stijl#define PRIx32 "x" /* uint32_t */ 115217155Stijl#define PRIx64 __PRI64"x" /* uint64_t */ 116217156Stijl#define PRIxLEAST8 "x" /* uint_least8_t */ 117217156Stijl#define PRIxLEAST16 "x" /* uint_least16_t */ 118217156Stijl#define PRIxLEAST32 "x" /* uint_least32_t */ 119217155Stijl#define PRIxLEAST64 __PRI64"x" /* uint_least64_t */ 120217156Stijl#define PRIxFAST8 "x" /* uint_fast8_t */ 121217156Stijl#define PRIxFAST16 "x" /* uint_fast16_t */ 122217156Stijl#define PRIxFAST32 "x" /* uint_fast32_t */ 123217155Stijl#define PRIxFAST64 __PRI64"x" /* uint_fast64_t */ 124217156Stijl#define PRIxMAX "jx" /* uintmax_t */ 125217155Stijl#define PRIxPTR __PRIptr"x" /* uintptr_t */ 12685892Smike 127217156Stijl#define PRIX8 "X" /* uint8_t */ 128217156Stijl#define PRIX16 "X" /* uint16_t */ 129217156Stijl#define PRIX32 "X" /* uint32_t */ 130217155Stijl#define PRIX64 __PRI64"X" /* uint64_t */ 131217156Stijl#define PRIXLEAST8 "X" /* uint_least8_t */ 132217156Stijl#define PRIXLEAST16 "X" /* uint_least16_t */ 133217156Stijl#define PRIXLEAST32 "X" /* uint_least32_t */ 134217155Stijl#define PRIXLEAST64 __PRI64"X" /* uint_least64_t */ 135217156Stijl#define PRIXFAST8 "X" /* uint_fast8_t */ 136217156Stijl#define PRIXFAST16 "X" /* uint_fast16_t */ 137217156Stijl#define PRIXFAST32 "X" /* uint_fast32_t */ 138217155Stijl#define PRIXFAST64 __PRI64"X" /* uint_fast64_t */ 139217156Stijl#define PRIXMAX "jX" /* uintmax_t */ 140217155Stijl#define PRIXPTR __PRIptr"X" /* uintptr_t */ 14185892Smike 14285892Smike/* fscanf(3) macros for signed integers. */ 14385892Smike 144217156Stijl#define SCNd8 "hhd" /* int8_t */ 145217156Stijl#define SCNd16 "hd" /* int16_t */ 146217156Stijl#define SCNd32 "d" /* int32_t */ 147217155Stijl#define SCNd64 __PRI64"d" /* int64_t */ 148217156Stijl#define SCNdLEAST8 "hhd" /* int_least8_t */ 149217156Stijl#define SCNdLEAST16 "hd" /* int_least16_t */ 150217156Stijl#define SCNdLEAST32 "d" /* int_least32_t */ 151217155Stijl#define SCNdLEAST64 __PRI64"d" /* int_least64_t */ 152217156Stijl#define SCNdFAST8 "d" /* int_fast8_t */ 153217156Stijl#define SCNdFAST16 "d" /* int_fast16_t */ 154217156Stijl#define SCNdFAST32 "d" /* int_fast32_t */ 155217155Stijl#define SCNdFAST64 __PRI64"d" /* int_fast64_t */ 156217156Stijl#define SCNdMAX "jd" /* intmax_t */ 157217155Stijl#define SCNdPTR __PRIptr"d" /* intptr_t */ 15885892Smike 159217156Stijl#define SCNi8 "hhi" /* int8_t */ 160217156Stijl#define SCNi16 "hi" /* int16_t */ 161217156Stijl#define SCNi32 "i" /* int32_t */ 162217155Stijl#define SCNi64 __PRI64"i" /* int64_t */ 163217156Stijl#define SCNiLEAST8 "hhi" /* int_least8_t */ 164217156Stijl#define SCNiLEAST16 "hi" /* int_least16_t */ 165217156Stijl#define SCNiLEAST32 "i" /* int_least32_t */ 166217155Stijl#define SCNiLEAST64 __PRI64"i" /* int_least64_t */ 167217156Stijl#define SCNiFAST8 "i" /* int_fast8_t */ 168217156Stijl#define SCNiFAST16 "i" /* int_fast16_t */ 169217156Stijl#define SCNiFAST32 "i" /* int_fast32_t */ 170217155Stijl#define SCNiFAST64 __PRI64"i" /* int_fast64_t */ 171217156Stijl#define SCNiMAX "ji" /* intmax_t */ 172217155Stijl#define SCNiPTR __PRIptr"i" /* intptr_t */ 17385892Smike 17485892Smike/* fscanf(3) macros for unsigned integers. */ 17585892Smike 176217156Stijl#define SCNo8 "hho" /* uint8_t */ 177217156Stijl#define SCNo16 "ho" /* uint16_t */ 178217156Stijl#define SCNo32 "o" /* uint32_t */ 179217155Stijl#define SCNo64 __PRI64"o" /* uint64_t */ 180217156Stijl#define SCNoLEAST8 "hho" /* uint_least8_t */ 181217156Stijl#define SCNoLEAST16 "ho" /* uint_least16_t */ 182217156Stijl#define SCNoLEAST32 "o" /* uint_least32_t */ 183217155Stijl#define SCNoLEAST64 __PRI64"o" /* uint_least64_t */ 184217156Stijl#define SCNoFAST8 "o" /* uint_fast8_t */ 185217156Stijl#define SCNoFAST16 "o" /* uint_fast16_t */ 186217156Stijl#define SCNoFAST32 "o" /* uint_fast32_t */ 187217155Stijl#define SCNoFAST64 __PRI64"o" /* uint_fast64_t */ 188217156Stijl#define SCNoMAX "jo" /* uintmax_t */ 189217155Stijl#define SCNoPTR __PRIptr"o" /* uintptr_t */ 19085892Smike 191217156Stijl#define SCNu8 "hhu" /* uint8_t */ 192217156Stijl#define SCNu16 "hu" /* uint16_t */ 193217156Stijl#define SCNu32 "u" /* uint32_t */ 194217155Stijl#define SCNu64 __PRI64"u" /* uint64_t */ 195217156Stijl#define SCNuLEAST8 "hhu" /* uint_least8_t */ 196217156Stijl#define SCNuLEAST16 "hu" /* uint_least16_t */ 197217156Stijl#define SCNuLEAST32 "u" /* uint_least32_t */ 198217155Stijl#define SCNuLEAST64 __PRI64"u" /* uint_least64_t */ 199217156Stijl#define SCNuFAST8 "u" /* uint_fast8_t */ 200217156Stijl#define SCNuFAST16 "u" /* uint_fast16_t */ 201217156Stijl#define SCNuFAST32 "u" /* uint_fast32_t */ 202217155Stijl#define SCNuFAST64 __PRI64"u" /* uint_fast64_t */ 203217156Stijl#define SCNuMAX "ju" /* uintmax_t */ 204217155Stijl#define SCNuPTR __PRIptr"u" /* uintptr_t */ 20585892Smike 206217156Stijl#define SCNx8 "hhx" /* uint8_t */ 207217156Stijl#define SCNx16 "hx" /* uint16_t */ 208217156Stijl#define SCNx32 "x" /* uint32_t */ 209217155Stijl#define SCNx64 __PRI64"x" /* uint64_t */ 210217156Stijl#define SCNxLEAST8 "hhx" /* uint_least8_t */ 211217156Stijl#define SCNxLEAST16 "hx" /* uint_least16_t */ 212217156Stijl#define SCNxLEAST32 "x" /* uint_least32_t */ 213217155Stijl#define SCNxLEAST64 __PRI64"x" /* uint_least64_t */ 214217156Stijl#define SCNxFAST8 "x" /* uint_fast8_t */ 215217156Stijl#define SCNxFAST16 "x" /* uint_fast16_t */ 216217156Stijl#define SCNxFAST32 "x" /* uint_fast32_t */ 217217155Stijl#define SCNxFAST64 __PRI64"x" /* uint_fast64_t */ 218217156Stijl#define SCNxMAX "jx" /* uintmax_t */ 219217155Stijl#define SCNxPTR __PRIptr"x" /* uintptr_t */ 22085892Smike 22185892Smike#endif /* !_MACHINE_INTTYPES_H_ */ 222