Skip to content

Commit 7c99aa2

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 2ff7b21 commit 7c99aa2

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
@@ -214,7 +214,7 @@ pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict:
214214
pub trait BasicHashComputer {
215215
fn HashBytes(&self, data: &[u8]) -> u32;
216216
fn BUCKET_BITS(&self) -> i32;
217-
fn USE_DICTIONARY(&self) -> i32;
217+
fn use_dictionary(&self) -> bool;
218218
fn BUCKET_SWEEP(&self) -> i32;
219219
}
220220
pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> {
@@ -438,7 +438,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
438438
}
439439
}
440440
}
441-
if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found {
441+
if dictionary.is_some() && self.buckets_.use_dictionary() && !is_match_found {
442442
is_match_found = SearchInStaticDictionary(
443443
dictionary.unwrap(),
444444
dictionary_hash,
@@ -469,8 +469,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> {
469469
fn BUCKET_SWEEP(&self) -> i32 {
470470
1
471471
}
472-
fn USE_DICTIONARY(&self) -> i32 {
473-
1
472+
fn use_dictionary(&self) -> bool {
473+
true
474474
}
475475
}
476476
impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> {
@@ -503,8 +503,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> {
503503
fn BUCKET_SWEEP(&self) -> i32 {
504504
2
505505
}
506-
fn USE_DICTIONARY(&self) -> i32 {
507-
0
506+
fn use_dictionary(&self) -> bool {
507+
false
508508
}
509509
fn HashBytes(&self, data: &[u8]) -> u32 {
510510
let h: u64 =
@@ -522,8 +522,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> {
522522
fn BUCKET_SWEEP(&self) -> i32 {
523523
4
524524
}
525-
fn USE_DICTIONARY(&self) -> i32 {
526-
1
525+
fn use_dictionary(&self) -> bool {
526+
true
527527
}
528528
fn HashBytes(&self, data: &[u8]) -> u32 {
529529
let h: u64 =
@@ -551,8 +551,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> {
551551
fn BUCKET_SWEEP(&self) -> i32 {
552552
4
553553
}
554-
fn USE_DICTIONARY(&self) -> i32 {
555-
0
554+
fn use_dictionary(&self) -> bool {
555+
false
556556
}
557557
fn HashBytes(&self, data: &[u8]) -> u32 {
558558
let h: u64 =

0 commit comments

Comments
 (0)