From 5b3c13cf42366370b208d054b5ceef206b737bdc Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 20 Mar 2024 02:36:55 -0400 Subject: [PATCH] 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?) --- src/enc/backward_references/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/enc/backward_references/mod.rs b/src/enc/backward_references/mod.rs index 120c25dd..9363fa5e 100644 --- a/src/enc/backward_references/mod.rs +++ b/src/enc/backward_references/mod.rs @@ -207,7 +207,7 @@ pub fn StoreLookaheadThenStore(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 + SliceWrapper + BasicHashComputer> { @@ -431,7 +431,7 @@ impl + SliceWrapper + 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, @@ -462,8 +462,8 @@ impl> BasicHashComputer for H2Sub { fn BUCKET_SWEEP(&self) -> i32 { 1 } - fn USE_DICTIONARY(&self) -> i32 { - 1 + fn use_dictionary(&self) -> bool { + true } } impl> SliceWrapperMut for H2Sub { @@ -496,8 +496,8 @@ impl> BasicHashComputer for H3Sub { 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 = @@ -515,8 +515,8 @@ impl> BasicHashComputer for H4Sub { 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 = @@ -544,8 +544,8 @@ impl> BasicHashComputer for H54Sub { 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 =