You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-rd-hashd/0001-Disambiguate-num-Integ...

57 lines
2.1 KiB

From d7ea03257825c173fcd4b8eed26fb177f638bfb3 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Mon, 9 Oct 2023 01:33:38 +0200
Subject: [PATCH] Disambiguate num::Integer::div_ceil from <number>::div_ceil
---
src/bench.rs | 2 +-
src/hasher.rs | 4 ++--
src/testfiles.rs | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/bench.rs b/src/bench.rs
index 85603a8..5092a41 100644
--- a/src/bench.rs
+++ b/src/bench.rs
@@ -649,7 +649,7 @@ impl Bench {
fn time_hash(size: usize, params: &Params, tf: &TestFiles) -> f64 {
let mut hasher = hasher::Hasher::new(1.0, 0.0);
let chunk_size = params.chunk_pages * *PAGE_SIZE;
- let chunks_per_unit = (tf.unit_size as usize).div_ceil(&chunk_size);
+ let chunks_per_unit = Integer::div_ceil(&(tf.unit_size as usize), &chunk_size);
let started_at = Instant::now();
diff --git a/src/hasher.rs b/src/hasher.rs
index 6ee2084..7e5d3e5 100644
--- a/src/hasher.rs
+++ b/src/hasher.rs
@@ -580,9 +580,9 @@ impl DispatchThread {
// determined by each hash worker to avoid overloading the
// dispatch thread.
let file_size = self.file_size_normal.sample(&mut rng).round() as usize;
- let file_nr_chunks = file_size.div_ceil(&chunk_size).max(1);
+ let file_nr_chunks = Integer::div_ceil(&file_size, &chunk_size).max(1);
let anon_size = self.anon_size_normal.sample(&mut rng).round() as usize;
- let anon_nr_chunks = anon_size.div_ceil(&chunk_size);
+ let anon_nr_chunks = Integer::div_ceil(&anon_size, &chunk_size);
let hasher_thread = HasherThread {
tf: self.tf.clone(),
diff --git a/src/testfiles.rs b/src/testfiles.rs
index 28e046a..b7dc555 100644
--- a/src/testfiles.rs
+++ b/src/testfiles.rs
@@ -34,7 +34,7 @@ impl TestFiles {
base_path: PathBuf::from(base_path.as_ref()),
unit_size,
size,
- nr_files: size.div_ceil(&unit_size),
+ nr_files: Integer::div_ceil(&size, &unit_size),
comp,
prefix: String::from(DFL_PREFIX),
}
--
2.41.0