X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fhuman_readable.c;h=ff1b5514118fcb49eef1cde03c288313820cc85c;hb=b95636c52fbb058a39548bcbc4e86456ebbd7b7b;hp=115fde7444fb013a14b1540fffcbc7d1fed073e4;hpb=63fc1a9e08fabfc8ba96bad80731673ef40bf5cb;p=oweals%2Fbusybox.git diff --git a/libbb/human_readable.c b/libbb/human_readable.c index 115fde744..ff1b55141 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c @@ -58,12 +58,13 @@ const char *make_human_readable_str(unsigned long long size, val /= display_unit; /* Don't combine with the line above!!! */ } else { ++u; - while ((val >= KILOBYTE) - && (u < zero_and_units + sizeof(zero_and_units) - 1)) { + while ((val >= 1024) + && (u < zero_and_units + sizeof(zero_and_units) - 1) + ) { f = fmt_tenths; ++u; - frac = ((((int)(val % KILOBYTE)) * 10) + (KILOBYTE/2)) / KILOBYTE; - val /= KILOBYTE; + frac = (((int)(val % 1024)) * 10 + 1024/2) / 1024; + val /= 1024; } if (frac >= 10) { /* We need to round up here. */ ++val;