[PATCH v2 7/9] include: sbi_types: add PRIx64 format macro
Pawandeep Oza
pawandeep.oza at oss.qualcomm.com
Thu Sep 3 14:59:50 PDT 2026
On Mon, Aug 17, 2026 at 2:05 AM Yu-Chien Peter Lin <peter.lin at sifive.com> wrote:
>
> Add PRIx64 for portable 64-bit hex printing. Expands
> to 016lx on RV64 and 016llx on RV32, enabling consistent
> printf-style formatting of uint64_t values.
>
> Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
> ---
> 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
>
Reviewed-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>
More information about the opensbi
mailing list