From d11dc0b503c7b6d6086e8deb0cb5d73fb5553604 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 27 May 2021 19:33:29 +0200 Subject: [PATCH] libbase/memtest: Print size with 1 digit after the decimal point. --- litex/soc/software/libbase/memtest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litex/soc/software/libbase/memtest.c b/litex/soc/software/libbase/memtest.c index 62d4b8711..7d4d3e2b5 100644 --- a/litex/soc/software/libbase/memtest.c +++ b/litex/soc/software/libbase/memtest.c @@ -165,11 +165,11 @@ static void print_size(unsigned long size) { if (size < KIB) printf("%luB", size); else if (size < MIB) - printf("%luKiB", size/KIB); + printf("%lu.%luKiB", size/KIB, (size/1 - KIB*(size/KIB))/(KIB/10)); else if (size < GIB) - printf("%luMiB", size/MIB); + printf("%lu.%luMiB", size/MIB, (size/KIB - KIB*(size/MIB))/(KIB/10)); else - printf("%luGiB", size/GIB); + printf("%lu.%luGiB", size/GIB, (size/MIB - KIB*(size/GIB))/(KIB/10)); } static void print_speed(unsigned long speed) {