From 89f60e66d38674e754178225bd0e25c689118df9 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Thu, 19 Jan 2023 00:06:46 +0100 Subject: [PATCH] liblitedram/utils: fix format warnings Use format constants for fixed width integer types to make it work on both 32-bit and 64-bit CPUs without warnings. Signed-off-by: Michal Sieron --- litex/soc/software/liblitedram/utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litex/soc/software/liblitedram/utils.c b/litex/soc/software/liblitedram/utils.c index 9dd18f918..3b6ef2dc3 100644 --- a/litex/soc/software/liblitedram/utils.c +++ b/litex/soc/software/liblitedram/utils.c @@ -14,18 +14,18 @@ void print_size(uint64_t size) { if (size < KIB) - printf("%lluB", size); + printf("%" PRIu64 "B", size); else if (size < MIB) - printf("%llu.%lluKiB", size/KIB, (size/1 - KIB*(size/KIB))/(KIB/10)); + printf("%" PRIu64 ".%" PRIu64 "KiB", size/KIB, (size/1 - KIB*(size/KIB))/(KIB/10)); else if (size < GIB) - printf("%llu.%lluMiB", size/MIB, (size/KIB - KIB*(size/MIB))/(KIB/10)); + printf("%" PRIu64 ".%" PRIu64 "MiB", size/MIB, (size/KIB - KIB*(size/MIB))/(KIB/10)); else - printf("%llu.%lluGiB", size/GIB, (size/MIB - KIB*(size/GIB))/(KIB/10)); + printf("%" PRIu64 ".%" PRIu64 "GiB", size/GIB, (size/MIB - KIB*(size/GIB))/(KIB/10)); } void print_progress(const char * header, uint64_t origin, uint64_t size) { - printf("%s 0x%llx-0x%llx ", header, origin, origin + size); + printf("%s 0x%" PRIx64 "-0x%" PRIx64 " ", header, origin, origin + size); print_size(size); printf(" \r"); } @@ -62,4 +62,4 @@ uint64_t sdram_get_supported_memory(void) { #endif /* CONFIG_HAS_I2C */ } -#endif \ No newline at end of file +#endif