Skip to content

Commit 6e1b3c7

Browse files
committed
Convert to bool BasicHashComputer::use_dictionary and proper case
Since this is a breaking change, refactoring the naming as well (perhaps should rename other trait methods for consistency?)
1 parent c35494b commit 6e1b3c7

File tree

1 file changed

+10
-10
lines changed
  • src/enc/backward_references

1 file changed

+10
-10
lines changed

src/enc/backward_references/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict:
211211
pub trait BasicHashComputer {
212212
fn HashBytes(&self, data: &[u8]) -> u32;
213213
fn BUCKET_BITS(&self) -> i32;
214-
fn USE_DICTIONARY(&self) -> i32;
214+
fn use_dictionary(&self) -> bool;
215215
fn BUCKET_SWEEP(&self) -> i32;
216216
}
217217
pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> {
@@ -435,7 +435,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
435435
}
436436
}
437437
}
438-
if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found {
438+
if dictionary.is_some() && self.buckets_.use_dictionary() && !is_match_found {
439439
is_match_found = SearchInStaticDictionary(
440440
dictionary.unwrap(),
441441
dictionary_hash,
@@ -466,8 +466,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> {
466466
fn BUCKET_SWEEP(&self) -> i32 {
467467
1
468468
}
469-
fn USE_DICTIONARY(&self) -> i32 {
470-
1
469+
fn use_dictionary(&self) -> bool {
470+
true
471471
}
472472
}
473473
impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> {
@@ -500,8 +500,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> {
500500
fn BUCKET_SWEEP(&self) -> i32 {
501501
2
502502
}
503-
fn USE_DICTIONARY(&self) -> i32 {
504-
0
503+
fn use_dictionary(&self) -> bool {
504+
false
505505
}
506506
fn HashBytes(&self, data: &[u8]) -> u32 {
507507
let h: u64 =
@@ -519,8 +519,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> {
519519
fn BUCKET_SWEEP(&self) -> i32 {
520520
4
521521
}
522-
fn USE_DICTIONARY(&self) -> i32 {
523-
1
522+
fn use_dictionary(&self) -> bool {
523+
true
524524
}
525525
fn HashBytes(&self, data: &[u8]) -> u32 {
526526
let h: u64 =
@@ -548,8 +548,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> {
548548
fn BUCKET_SWEEP(&self) -> i32 {
549549
4
550550
}
551-
fn USE_DICTIONARY(&self) -> i32 {
552-
0
551+
fn use_dictionary(&self) -> bool {
552+
false
553553
}
554554
fn HashBytes(&self, data: &[u8]) -> u32 {
555555
let h: u64 =

0 commit comments

Comments
 (0)