> -----Original Message----- > From: dmidecode-devel <dmidecode-devel-bounces+elliott=hpe....@nongnu.org> > On Behalf Of Jean Delvare > Sent: Tuesday, December 11, 2018 2:20 PM > To: dmidecode-devel@nongnu.org > Subject: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit > for cache size > > As newer CPUs have larger and larger cache, using kB to represent the > cache size is getting less convenient. Reuse the same function we have > for system memory size so that large units will be used as > appropriate. For example, a cache size reported as "20 MB" looks nicer > than as "20480 kB". > - if (code >= 0x8000) > - printf(" %u MB", code >> 4); > - else > - printf(" %u kB", code << 6); > + size.l = code << 6; > + size.h = code >> 26; > } > else > - printf(" %u kB", code); The value might not be an integer multiple of the larger prefix; if so, then you should either use floating point to show the fractional number (my recommendation), or stick with the smaller prefix. Consider using this opportunity to switch to the SI-recommended IEC-defined prefixes for binary multiples: KiB (1024) and MiB (1024*1024) rather than KB (1000) and MB (1000*1000). --- Robert Elliott, HPE Persistent Memory _______________________________________________ https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
Re: [dmidecode] [PATCH 1/2] dmidecode: Use the most appropriate unit for cache size
Elliott, Robert (Persistent Memory) Mon, 17 Dec 2018 07:50:47 -0800
- [dmidecode] [PATCH 1/2] dmidecode: Use... Jean Delvare
- [dmidecode] [PATCH 2/2] dmidecode... Jean Delvare
- Re: [dmidecode] [PATCH 1/2] dmide... Neil Horman
- Re: [dmidecode] [PATCH 1/2] dmide... Elliott, Robert (Persistent Memory)
- Re: [dmidecode] [PATCH 1/2] d... Elliott, Robert (Persistent Memory)
- Re: [dmidecode] [PATCH 1/... Jean Delvare
- Re: [dmidecode] [PATCH 1/2] d... Jean Delvare