Skip to content

Commit 072cca6

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 85196be commit 072cca6

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/enc/backward_references/mod.rs

+10-10
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 =

src/enc/bit_cost.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use alloc::SliceWrapperMut;
2-
32
use core::cmp::{max, min};
43

54
use super::super::alloc::SliceWrapper;
@@ -8,7 +7,6 @@ use super::util::{FastLog2, FastLog2u16};
87
use super::vectorization::Mem256i;
98
use crate::enc::floatX;
109

11-
1210
const BROTLI_REPEAT_ZERO_CODE_LENGTH: usize = 17;
1311
const BROTLI_CODE_LENGTH_CODES: usize = BROTLI_REPEAT_ZERO_CODE_LENGTH + 1;
1412

0 commit comments

Comments
 (0)