[RFC PATCH 06/12] include: sbi_types: add PRIx64 format macro

Yu-Chien Peter Lin <[email protected]> Fri, 26 Jun 2026 18:14:27 +0800
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
Adds PRIx64 for portable 64-bit hex printing. Expands to "016lx" on RV64
(long is 64-bit), "016llx" on RV32 (long long is 64-bit). Enables
consistent printf-style formatting of uint64_t values with 16-digit
zero-padded output across XLEN configurations.

Signed-off-by: Yu-Chien Peter Lin <[email protected]>
---
 include/sbi/sbi_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h
index b8a7e6cb..780a4c2a 100644
--- a/include/sbi/sbi_types.h
+++ b/include/sbi/sbi_types.h
@@ -34,12 +34,14 @@ typedef unsigned long		u64;
 typedef long			int64_t;
 typedef unsigned long		uint64_t;
 #define PRILX			"016lx"
+#define PRIx64			"016lx"
 #elif __riscv_xlen == 32
 typedef long long		s64;
 typedef unsigned long long	u64;
 typedef long long		int64_t;
 typedef unsigned long long	uint64_t;
 #define PRILX			"08lx"
+#define PRIx64			"016llx"
 #else
 #error "Unexpected __riscv_xlen"
 #endif
-- 
2.43.7


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi