diff options
author | Canop <cano.petrole@gmail.com> | 2024-09-08 10:29:26 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2024-09-08 10:29:26 +0200 |
commit | 106440537d0710ea5b75aeae5bb1563289a78fa2 (patch) | |
tree | 97cd124e044093eb1883127c9e8487d56388de07 | |
parent | 869453c922d30a1bc85351a956f00dfbfd3a73eb (diff) | |
parent | 56104947e459d52c3ae8d1c45e9378922e4d11d6 (diff) |
-rw-r--r-- | cli/src/units.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/src/units.rs b/cli/src/units.rs index cb77a39..faa4ea9 100644 --- a/cli/src/units.rs +++ b/cli/src/units.rs @@ -37,9 +37,9 @@ impl Units { if size < 10_000 { size.to_string() } else { - let size = size as f64; - let i: u32 = (size.ln() / 1024f64.ln()) as u32; + let i = size.ilog2() / 10u32; let idx = i as usize - 1; + let size = size as f64; if idx >= PREFIXES.len() { "huge".to_string() } else { |