mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:17:34 +00:00
AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9". The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30". Let's use the correct name, at least in code. Only changes the name of the constants, no other behavior change.
This commit is contained in:
parent
a68650a7b4
commit
430b265cd4
31 changed files with 69 additions and 69 deletions
|
@ -69,7 +69,7 @@ int main()
|
|||
|
||||
printf("Success! Evil pointer: %p\n", ptr);
|
||||
|
||||
u8* base = &ptr[128 * MB];
|
||||
u8* base = &ptr[128 * MiB];
|
||||
|
||||
uintptr_t g_processes = *(uintptr_t*)&base[0x1b51c4];
|
||||
printf("base = %p\n", base);
|
||||
|
|
|
@ -58,13 +58,13 @@ static String number_string_with_one_decimal(float number, const char* suffix)
|
|||
|
||||
static String human_readable_size(size_t size)
|
||||
{
|
||||
if (size < 1 * KB)
|
||||
if (size < 1 * KiB)
|
||||
return String::number(size);
|
||||
if (size < 1 * MB)
|
||||
return number_string_with_one_decimal((float)size / (float)KB, "K");
|
||||
if (size < 1 * GB)
|
||||
return number_string_with_one_decimal((float)size / (float)MB, "M");
|
||||
return number_string_with_one_decimal((float)size / (float)GB, "G");
|
||||
if (size < 1 * MiB)
|
||||
return number_string_with_one_decimal((float)size / (float)KiB, "K");
|
||||
if (size < 1 * GiB)
|
||||
return number_string_with_one_decimal((float)size / (float)MiB, "M");
|
||||
return number_string_with_one_decimal((float)size / (float)GiB, "G");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
@ -40,12 +40,12 @@
|
|||
|
||||
static String si_bytes(unsigned bytes)
|
||||
{
|
||||
if (bytes >= GB)
|
||||
return String::format("%fGiB", (double)bytes / (double)GB);
|
||||
if (bytes >= MB)
|
||||
return String::format("%fMiB", (double)bytes / (double)MB);
|
||||
if (bytes >= KB)
|
||||
return String::format("%fkiB", (double)bytes / (double)KB);
|
||||
if (bytes >= GiB)
|
||||
return String::format("%fGiB", (double)bytes / (double)GiB);
|
||||
if (bytes >= MiB)
|
||||
return String::format("%fMiB", (double)bytes / (double)MiB);
|
||||
if (bytes >= KiB)
|
||||
return String::format("%fkiB", (double)bytes / (double)KiB);
|
||||
return String::format("%dB", bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -241,13 +241,13 @@ static String number_string_with_one_decimal(float number, const char* suffix)
|
|||
|
||||
static String human_readable_size(size_t size)
|
||||
{
|
||||
if (size < 1 * KB)
|
||||
if (size < 1 * KiB)
|
||||
return String::number(size);
|
||||
if (size < 1 * MB)
|
||||
return number_string_with_one_decimal((float)size / (float)KB, "K");
|
||||
if (size < 1 * GB)
|
||||
return number_string_with_one_decimal((float)size / (float)MB, "M");
|
||||
return number_string_with_one_decimal((float)size / (float)GB, "G");
|
||||
if (size < 1 * MiB)
|
||||
return number_string_with_one_decimal((float)size / (float)KiB, "K");
|
||||
if (size < 1 * GiB)
|
||||
return number_string_with_one_decimal((float)size / (float)MiB, "M");
|
||||
return number_string_with_one_decimal((float)size / (float)GiB, "G");
|
||||
}
|
||||
|
||||
static bool print_filesystem_object(const String& path, const String& name, const struct stat& st)
|
||||
|
|
|
@ -156,7 +156,7 @@ static bool unpack_file_for_central_directory_index(off_t central_directory_inde
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
const char* path;
|
||||
int map_size_limit = 32 * MB;
|
||||
int map_size_limit = 32 * MiB;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(map_size_limit, "Maximum chunk size to map", "map-size-limit", 0, "size");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue