free.c - name correctly the binary multiples in the human-readable case
This commit is contained in:
parent
27d0b400de
commit
9365be7633
11
free.c
11
free.c
@ -152,6 +152,16 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_
|
|||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
|
if (!(flags & FREE_SI)) {
|
||||||
|
if (5 >=
|
||||||
|
snprintf(buf, sizeof(buf), "%.1f%ci",
|
||||||
|
(float)((size / 1024) * base / power(base, i - 2)), *up))
|
||||||
|
return buf;
|
||||||
|
if (5 >=
|
||||||
|
snprintf(buf, sizeof(buf), "%ld%ci",
|
||||||
|
(long)((size / 1024) * base / power(base, i - 2)), *up))
|
||||||
|
return buf;
|
||||||
|
} else {
|
||||||
if (4 >=
|
if (4 >=
|
||||||
snprintf(buf, sizeof(buf), "%.1f%c",
|
snprintf(buf, sizeof(buf), "%.1f%c",
|
||||||
(float)((size / 1024) * base / power(base, i - 2)), *up))
|
(float)((size / 1024) * base / power(base, i - 2)), *up))
|
||||||
@ -160,6 +170,7 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_
|
|||||||
snprintf(buf, sizeof(buf), "%ld%c",
|
snprintf(buf, sizeof(buf), "%ld%c",
|
||||||
(long)((size / 1024) * base / power(base, i - 2)), *up))
|
(long)((size / 1024) * base / power(base, i - 2)), *up))
|
||||||
return buf;
|
return buf;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user