Skip to content

Commit 38440dc

Browse files
committed
refine code: remove unused code
1 parent 054107c commit 38440dc

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

datasketches/src/theta/hash_table.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -343,55 +343,6 @@ impl ThetaHashTable {
343343
compute_seed_hash(self.hash_seed)
344344
}
345345

346-
/// Returns true if the given hash exists in the table.
347-
#[allow(dead_code)]
348-
pub fn contains_hash(&self, hash: u64) -> bool {
349-
if hash == 0 {
350-
return false;
351-
}
352-
let Some(index) = self.find_in_curr_entries(hash) else {
353-
return false;
354-
};
355-
self.entries[index] == hash
356-
}
357-
358-
/// Set empty flag
359-
#[allow(dead_code)]
360-
pub fn set_empty(&mut self, is_empty: bool) {
361-
self.is_empty = is_empty;
362-
}
363-
364-
/// Get the hash seed used by this table.
365-
#[allow(dead_code)]
366-
pub fn hash_seed(&self) -> u64 {
367-
self.hash_seed
368-
}
369-
370-
/// Sets theta value.
371-
#[allow(dead_code)]
372-
pub fn set_theta(&mut self, theta: u64) {
373-
assert!(
374-
(1..=MAX_THETA).contains(&theta),
375-
"theta must be in [1, {MAX_THETA}], got {theta}"
376-
);
377-
self.theta = theta;
378-
}
379-
380-
/// Returns minimal lg_size where rebuild-capacity can hold `count`.
381-
#[allow(dead_code)]
382-
pub fn lg_size_from_count_for_rebuild(count: usize, load_factor: f64) -> u8 {
383-
let log2 = |n: usize| {
384-
if n == 0 { 0_u8 } else { n.ilog2() as u8 }
385-
};
386-
let log2_n = log2(count);
387-
log2_n
388-
+ (if count > (((1u128 << ((log2_n as u32) + 1)) as f64) * load_factor) as usize {
389-
2
390-
} else {
391-
1
392-
})
393-
}
394-
395346
/// Get stride for hash table probing
396347
fn get_stride(key: u64, lg_size: u8) -> usize {
397348
(2 * ((key >> (lg_size)) & STRIDE_MASK) + 1) as usize

0 commit comments

Comments
 (0)