Skip to content

Commit 148bb53

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 6c4cd18 commit 148bb53

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
@@ -207,7 +207,7 @@ pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict:
207207
pub trait BasicHashComputer {
208208
fn HashBytes(&self, data: &[u8]) -> u32;
209209
fn BUCKET_BITS(&self) -> i32;
210-
fn USE_DICTIONARY(&self) -> i32;
210+
fn use_dictionary(&self) -> bool;
211211
fn BUCKET_SWEEP(&self) -> i32;
212212
}
213213
pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> {
@@ -431,7 +431,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
431431
}
432432
}
433433
}
434-
if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found {
434+
if dictionary.is_some() && self.buckets_.use_dictionary() && !is_match_found {
435435
is_match_found = SearchInStaticDictionary(
436436
dictionary.unwrap(),
437437
dictionary_hash,
@@ -462,8 +462,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> {
462462
fn BUCKET_SWEEP(&self) -> i32 {
463463
1
464464
}
465-
fn USE_DICTIONARY(&self) -> i32 {
466-
1
465+
fn use_dictionary(&self) -> bool {
466+
true
467467
}
468468
}
469469
impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> {
@@ -496,8 +496,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> {
496496
fn BUCKET_SWEEP(&self) -> i32 {
497497
2
498498
}
499-
fn USE_DICTIONARY(&self) -> i32 {
500-
0
499+
fn use_dictionary(&self) -> bool {
500+
false
501501
}
502502
fn HashBytes(&self, data: &[u8]) -> u32 {
503503
let h: u64 =
@@ -515,8 +515,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> {
515515
fn BUCKET_SWEEP(&self) -> i32 {
516516
4
517517
}
518-
fn USE_DICTIONARY(&self) -> i32 {
519-
1
518+
fn use_dictionary(&self) -> bool {
519+
true
520520
}
521521
fn HashBytes(&self, data: &[u8]) -> u32 {
522522
let h: u64 =
@@ -544,8 +544,8 @@ impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> {
544544
fn BUCKET_SWEEP(&self) -> i32 {
545545
4
546546
}
547-
fn USE_DICTIONARY(&self) -> i32 {
548-
0
547+
fn use_dictionary(&self) -> bool {
548+
false
549549
}
550550
fn HashBytes(&self, data: &[u8]) -> u32 {
551551
let h: u64 =

0 commit comments

Comments
 (0)