[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] targphys.h: Define PRI*PLX format specifier mac
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 1/4] targphys.h: Define PRI*PLX format specifier macros |
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 <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
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
--
1.7.1