diff --git a/src/main.rs b/src/main.rs index 0b1ced5..032b8c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,10 +74,10 @@ fn worker( try_set_thread_priority(); static INC: once_cell::sync::Lazy = Lazy::new(BigUint::one); - - let one_thousand = &BigUint::from(SPLITTER * 10); - let one_hundred = &BigUint::from(SPLITTER); - let ten = &BigUint::from(10u8); + static ONE_THOUSAND: once_cell::sync::Lazy = + Lazy::new(|| BigUint::from(SPLITTER * 10)); + static ONE_HUNDRED: once_cell::sync::Lazy = Lazy::new(|| BigUint::from(SPLITTER)); + static TEN: once_cell::sync::Lazy = Lazy::new(|| BigUint::from(10u8)); let work_uint = BigUint::from(workloads); let mut number = BigUint::from(i) * &work_uint; @@ -94,7 +94,7 @@ fn worker( progress.fetch_add(1, std::sync::atomic::Ordering::Relaxed); } - if (&number * one_thousand) / &max / ten == &number / &max * one_hundred { + if (&number * &*ONE_THOUSAND) / &max / &*TEN == &number / &max * &*ONE_HUNDRED { drop(global_primes); let mut new_primecache = arcclone.write().unwrap();