aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 714ce9d..b077484 100644
--- a/src/util.c
+++ b/src/util.c
@@ -200,11 +200,11 @@ int snprintf_units(char *buffer, size_t max, uint64_t bytes, unit_t unit)
break;
default: {
- int i = -1;
- do {
+ int i = 0;
+ while (round(value) >= base && i < 4) {
value /= base;
i++;
- } while (round(value * 10) / 10 >= base && i < 4);
+ }
const char *units[2][5] = {
{ " B", " kB", " MB", " GB", " TB" },