Skip to content

Commit 4362933

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 dac157a commit 4362933

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict:
208208
pub trait BasicHashComputer {
209209
fn HashBytes(&self, data: &[u8]) -> u32;
210210
fn BUCKET_BITS(&self) -> i32;
211-
fn USE_DICTIONARY(&self) -> i32;
211+
fn use_dictionary(&self) -> bool;
212212
fn BUCKET_SWEEP(&self) -> i32;
213213
}
214214
pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> {
@@ -432,7 +432,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
432432
}
433433
}
434434
}
435-
if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found {
435+
if dictionary.is_some() && self.buckets_.use_dictionary() && !is_match_found {
436436
is_match_found = SearchInStaticDictionary(
437437
dictionary.unwrap(),
438438
dictionary_hash,
@@ -463,8 +463,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> {
463463
fn BUCKET_SWEEP(&self) -> i32 {
464464
1
465465
}
466-
fn USE_DICTIONARY(&self) -> i32 {
467-
1
466+
fn use_dictionary(&self) -> bool {
467+
true
468468
}
469469
}
470470
impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> {
@@ -497,8 +497,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> {
497497
fn BUCKET_SWEEP(&self) -> i32 {
498498
2
499499
}
500-
fn USE_DICTIONARY(&self) -> i32 {
501-
0
500+
fn use_dictionary(&self) -> bool {
501+
false
502502
}
503503
fn HashBytes(&self, data: &[u8]) -> u32 {
504504
let h: u64 =
@@ -516,8 +516,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> {
516516
fn BUCKET_SWEEP(&self) -> i32 {
517517
4
518518
}
519-
fn USE_DICTIONARY(&self) -> i32 {
520-
1
519+
fn use_dictionary(&self) -> bool {
520+
true
521521
}
522522
fn HashBytes(&self, data: &[u8]) -> u32 {
523523
let h: u64 =
@@ -545,8 +545,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> {
545545
fn BUCKET_SWEEP(&self) -> i32 {
546546
4
547547
}
548-
fn USE_DICTIONARY(&self) -> i32 {
549-
0
548+
fn use_dictionary(&self) -> bool {
549+
false
550550
}
551551
fn HashBytes(&self, data: &[u8]) -> u32 {
552552
let h: u64 =

0 commit comments

Comments
 (0)