dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for


From: Jean Delvare
Subject: Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for cache size
Date: Tue, 18 Dec 2018 13:49:11 +0100

On Mon, 17 Dec 2018 17:25:19 +0000, Elliott, Robert (Persistent Memory) wrote:
> Here's some code I submitted to grub long ago to print the biggest unit
> prefixes without rounding:
> 
>       if (size & 0xfffff)
>        grub_printf (" %6" PRIuGRUB_UINT64_T "KiB", size >> 10);
>       else if (size & 0x3fffffff)
>        grub_printf (" %6" PRIuGRUB_UINT64_T "MiB", size >> 20);
>       else if (size & 0xffffffffff)
>        grub_printf (" %6" PRIuGRUB_UINT64_T "GiB", size >> 30);
>       else if (size & 0x3ffffffffffff)
>        grub_printf (" %6" PRIuGRUB_UINT64_T "TiB", size >> 40);
>       else if (size & 0xfffffffffffffff)
>        grub_printf (" %6" PRIuGRUB_UINT64_T "PiB", size >> 50);
>       else
>        grub_printf (" %6" PRIuGRUB_UINT64_T "EiB", size >> 60);

I don't like it much. I can't see how "without rounding" is a goal for
dmidecode. Being easy to read by a human being seems more important to
me.

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]