Re: [PATCH v2] display_options: print_size: Fix order overflow

2022-09-23 Thread Tom Rini
On Mon, Sep 12, 2022 at 09:02:27PM +0200, Pali Rohár 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". >

Re: [PATCH v2] display_options: print_size: Fix order overflow

2022-09-14 Thread Simon Glass
On Mon, 12 Sept 2022 at 13:03, Pali Rohár 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

[PATCH v2] display_options: print_size: Fix order overflow

2022-09-12 Thread Pali Rohár
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.