Use saturating arithmetic on calculating row saving
The saturating arithmetic doesn't overflow, but stays at the maximum or minimum. In this case it doesn't become negative, but zero, which satisfies the condition below. Closes #31
This commit is contained in:
@@ -229,7 +229,7 @@ fn main() {
|
||||
);
|
||||
|
||||
if let Some(min) = min_saved_rows {
|
||||
let saving = (original_summed_size - compressed_summed_size) as i32;
|
||||
let saving = original_summed_size.saturating_sub(compressed_summed_size);
|
||||
if saving < min {
|
||||
println!(
|
||||
"Only {} rows would be saved by this compression. Skipping output.",
|
||||
|
||||
Reference in New Issue
Block a user