From 4ab1d61c289a974737d896fefb100c19c254375e Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 16 Mar 2020 12:10:25 +0100 Subject: [PATCH] Fix number of IO-Threads for single-cores --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 03b933e..2bef274 100644 --- a/src/main.rs +++ b/src/main.rs @@ -176,7 +176,7 @@ fn create_dictionary(_opts: &Opts, args: &CreateDictionary) { let bdf_arc = Arc::new(Mutex::new(bdf_file)); let pb_arc = Arc::new(Mutex::new(pb)); - for _ in 0..(num_cpus::get() as f32 / 4f32).ceil() as usize { + for _ in 0..(num_cpus::get() as f32 / 4f32).max(1f32) as usize { let tx = tx.clone(); let bdf_arc = Arc::clone(&bdf_arc); let pb_arc = Arc::clone(&pb_arc); @@ -246,7 +246,7 @@ fn decrypt_with_dictionary_file(filename: String, data: &Vec) -> Option>(100); - for _ in 0..(num_cpus::get() as f32 / 4f32).ceil() as usize { + for _ in 0..(num_cpus::get() as f32 / 4f32).max(1f32) as usize { let rx = rx.clone(); let bdf_arc = Arc::clone(&bdf_arc);