mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
AK: Use new format functions.
This commit is contained in:
parent
560c52989c
commit
1d96d5eea4
13 changed files with 74 additions and 91 deletions
|
@ -35,13 +35,13 @@ namespace AK {
|
|||
static String number_string_with_one_decimal(u64 number, u32 unit, const char* suffix)
|
||||
{
|
||||
int decimal = (number % unit) * 10 / unit;
|
||||
return String::format("%llu.%d %s", number / unit, decimal, suffix);
|
||||
return String::formatted("{}.{} {}", number / unit, decimal, suffix);
|
||||
}
|
||||
|
||||
static inline String human_readable_size(size_t size)
|
||||
{
|
||||
if (size < 1 * KiB)
|
||||
return String::format("%zu B", size);
|
||||
return String::formatted("{} B", size);
|
||||
if (size < 1 * MiB)
|
||||
return number_string_with_one_decimal(size, KiB, "KiB");
|
||||
if (size < 1 * GiB)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue