Skip to content

Commit

Permalink
Convert to bool BasicHashComputer::use_dictionary and proper case
Browse files Browse the repository at this point in the history
Since this is a breaking change, refactoring the naming as well (perhaps should rename other trait methods for consistency?)
  • Loading branch information
nyurik committed May 11, 2024
1 parent 5ad7153 commit 8c64e26
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/enc/backward_references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict:
pub trait BasicHashComputer {
fn HashBytes(&self, data: &[u8]) -> u32;
fn BUCKET_BITS(&self) -> i32;
fn USE_DICTIONARY(&self) -> i32;
fn use_dictionary(&self) -> bool;
fn BUCKET_SWEEP(&self) -> i32;
}
pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> {
Expand Down Expand Up @@ -432,7 +432,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
}
}
}
if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found {
if dictionary.is_some() && self.buckets_.use_dictionary() && !is_match_found {
is_match_found = SearchInStaticDictionary(
dictionary.unwrap(),
dictionary_hash,
Expand Down Expand Up @@ -463,8 +463,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> {
fn BUCKET_SWEEP(&self) -> i32 {
1
}
fn USE_DICTIONARY(&self) -> i32 {
1
fn use_dictionary(&self) -> bool {
true
}
}
impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> {
Expand Down Expand Up @@ -497,8 +497,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> {
fn BUCKET_SWEEP(&self) -> i32 {
2
}
fn USE_DICTIONARY(&self) -> i32 {
0
fn use_dictionary(&self) -> bool {
false
}
fn HashBytes(&self, data: &[u8]) -> u32 {
let h: u64 =
Expand All @@ -516,8 +516,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> {
fn BUCKET_SWEEP(&self) -> i32 {
4
}
fn USE_DICTIONARY(&self) -> i32 {
1
fn use_dictionary(&self) -> bool {
true
}
fn HashBytes(&self, data: &[u8]) -> u32 {
let h: u64 =
Expand Down Expand Up @@ -545,8 +545,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> {
fn BUCKET_SWEEP(&self) -> i32 {
4
}
fn USE_DICTIONARY(&self) -> i32 {
0
fn use_dictionary(&self) -> bool {
false
}
fn HashBytes(&self, data: &[u8]) -> u32 {
let h: u64 =
Expand Down

0 comments on commit 8c64e26

Please sign in to comment.