mirror of https://github.com/jarun/nnn.git
float is suficient and a _little_ faster in coolsize()
This commit is contained in:
parent
4d93a7f9fe
commit
928699d4a4
4
nnn.c
4
nnn.c
|
@ -1441,7 +1441,7 @@ coolsize(off_t size)
|
||||||
static char size_buf[12]; /* Buffer to hold human readable size */
|
static char size_buf[12]; /* Buffer to hold human readable size */
|
||||||
static int i;
|
static int i;
|
||||||
|
|
||||||
static long double rem;
|
static off_t rem;
|
||||||
static const double div_2_pow_10 = 1.0 / 1024.0;
|
static const double div_2_pow_10 = 1.0 / 1024.0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -1453,7 +1453,7 @@ coolsize(off_t size)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(size_buf, 12, "%.*Lf%c", i, size + rem * div_2_pow_10, U[i]);
|
snprintf(size_buf, 12, "%.*f%c", i, size + (float)rem * div_2_pow_10, U[i]);
|
||||||
return size_buf;
|
return size_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue