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 Apr 7, 2024
1 parent 2ff7b21 commit 7c99aa2
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 @@ -214,7 +214,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 @@ -438,7 +438,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 @@ -469,8 +469,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 @@ -503,8 +503,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 @@ -522,8 +522,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 @@ -551,8 +551,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 7c99aa2

Please sign in to comment.