Skip to content

Commit b3fa87f

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 b3fa87f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/bin/integration_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ fn test_random_then_unicode_9() {
385385
roundtrip_helper(RANDOM_THEN_UNICODE, 9, 22, false);
386386
}
387387
#[cfg(feature="std")]
388-
const random_then_unicode_compressed_size_9_5 : usize = 136542;
388+
const random_then_unicode_compressed_size_9_5 : usize = 136126;
389389
#[cfg(feature="std")]
390390
const random_then_unicode_compressed_size_9_5x : usize = 136045;
391391

@@ -412,7 +412,7 @@ const alice_compressed_size_11 : usize = 46510;
412412

413413

414414
#[cfg(not(feature="std"))] // approx log
415-
const random_then_unicode_compressed_size_9_5 : usize = 136719;
415+
const random_then_unicode_compressed_size_9_5 : usize = 136409;
416416
#[cfg(not(feature="std"))] // approx log
417417
const random_then_unicode_compressed_size_9_5x : usize = 136095;
418418

src/enc/backward_references/mod.rs

+4-4
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)