
14 Sep
2022
14 Sep
'22
7:10 p.m.
On Mon, 12 Sept 2022 at 13:03, Pali Rohár pali@kernel.org wrote:
Function print_size() round size to the nearst value with one decimal fraction number. But in special cases also unit order may overflow.
For example value 1073689396 is printed as "1024 MiB" and value 1073741824 as "1 GiB".
Fix this issue by detecting order overflow and increasing unit order. With this change also value 1073689396 is printed as "1 GiB".
Signed-off-by: Pali Rohár pali@kernel.org
Changes in v2:
- Add unit test case
lib/display_options.c | 6 ++++++ test/lib/test_print.c | 3 +++ 2 files changed, 9 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org