From 6e1b3c7cc28ecd316699e4a3ef4b88d80b0ff8d0 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 c413f812..cc5cefc0 100644 --- a/src/enc/backward_references/mod.rs +++ b/src/enc/backward_references/mod.rs @@ -211,7 +211,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> { @@ -435,7 +435,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, @@ -466,8 +466,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 { @@ -500,8 +500,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 = @@ -519,8 +519,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 = @@ -548,8 +548,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 =