From patchwork Mon Jun 25 12:45:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [1/4] targphys.h: Define PRI*PLX format specifier macros From: Peter Maydell X-Patchwork-Id: 167102 Message-Id: <1340628316-26267-2-git-send-email-peter.maydell@linaro.org> To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org Date: Mon, 25 Jun 2012 13:45:13 +0100 Define a set of PRI*PLX format specifier macros for working with target_phys_addr_t types. These follow the standard pattern for such macros, and are more flexible than TARGET_FMT_plx, which does not allow specification of field widths. Suggested-by: Andreas Färber Signed-off-by: Peter Maydell --- targphys.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/targphys.h b/targphys.h index 95648d6..d5b5636 100644 --- a/targphys.h +++ b/targphys.h @@ -11,10 +11,26 @@ typedef uint32_t target_phys_addr_t; #define TARGET_PHYS_ADDR_MAX UINT32_MAX #define TARGET_FMT_plx "%08x" +/* Format strings for printing target_phys_addr_t types. + * These are recommended over the less flexible TARGET_FMT_plx, + * which is retained for the benefit of existing code. + */ +#define PRIdPLX PRId32 +#define PRIiPLX PRIi32 +#define PRIoPLX PRIo32 +#define PRIuPLX PRIu32 +#define PRIxPLX PRIx32 +#define PRIXPLX PRIX32 #elif TARGET_PHYS_ADDR_BITS == 64 typedef uint64_t target_phys_addr_t; #define TARGET_PHYS_ADDR_MAX UINT64_MAX #define TARGET_FMT_plx "%016" PRIx64 +#define PRIdPLX PRId64 +#define PRIiPLX PRIi64 +#define PRIoPLX PRIo64 +#define PRIuPLX PRIu64 +#define PRIxPLX PRIx64 +#define PRIXPLX PRIX64 #endif #endif