X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fhuman_readable.c;h=ff1b5514118fcb49eef1cde03c288313820cc85c;hb=966ec7c067d7a2df5232a69c8d3d2e777347a62d;hp=cf029c0a244566a03180186542256c02768be0d6;hpb=d409c3a2f787dd2276d242d70e03b25e33436cea;p=oweals%2Fbusybox.git diff --git a/libbb/human_readable.c b/libbb/human_readable.c index cf029c0a2..ff1b55141 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * June 30, 2001 Manuel Novoa III * @@ -57,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;