diff --git a/src/backup/mod.rs b/src/backup/mod.rs index f569697..cb9aa16 100644 --- a/src/backup/mod.rs +++ b/src/backup/mod.rs @@ -235,13 +235,8 @@ impl fmt::Display for Backup { // Pretty-print size // If your backup is a petabyte or larger, this will crash and you need to re-evaluate your // life choices - let mut index = 0; - let mut size = self.size as f64; - - while size >= 1024.0 { - index += 1; - size /= 1024.0; - } + let index = self.size.ilog(1024) as usize; + let size = self.size as f64 / (1024.0_f64.powi(index as i32)); write!( f,