Skip to content

Commit 12ab1d2

Browse files
committed
switch back to the C brotli default of 5 bytes of backwards info for the hashing function for prior copies
1 parent bb17a3a commit 12ab1d2

File tree

1 file changed

+4
-4
lines changed
  • src/enc/backward_references

1 file changed

+4
-4
lines changed

src/enc/backward_references/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,17 +679,17 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
679679
}
680680
#[inline(always)]
681681
fn HashBytes(&self, data: &[u8]) -> usize {
682-
let h: u32 = BROTLI_UNALIGNED_LOAD32(data).wrapping_mul(kHashMul32);
683-
let thirty_two : usize = 32;
682+
let h: u64 = (BROTLI_UNALIGNED_LOAD32(data) as u64| ((data[4] as u64) << 32)).wrapping_mul(kHashMul64Long);
683+
let thirty_two : usize = 64;
684684
(h >> (thirty_two.wrapping_sub(H9_BUCKET_BITS))) as usize
685685
}
686686
#[inline(always)]
687687
fn HashTypeLength(&self) -> usize {
688-
4
688+
5
689689
}
690690
#[inline(always)]
691691
fn StoreLookahead(&self) -> usize {
692-
4
692+
5
693693
}
694694
fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) {
695695
let num_distances = H9_NUM_LAST_DISTANCES_TO_CHECK as i32;

0 commit comments

Comments
 (0)