Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to bool BasicHashComputer::use_dictionary and proper case #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/enc/backward_references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,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 @@ -431,7 +431,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 @@ -462,8 +462,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 @@ -496,8 +496,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 @@ -515,8 +515,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 @@ -544,8 +544,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