Skip to content

Commit e0768e7

Browse files
brianpanefolkertdev
authored andcommitted
Hard-code the hash function for the quick deflate algorithm
1 parent 265fb74 commit e0768e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

zlib-rs/src/deflate/algorithm/quick.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![forbid(unsafe_code)]
22

3+
use crate::deflate::hash_calc::StandardHashCalc;
34
use crate::{
45
deflate::{
56
fill_window, flush_pending, BlockState, BlockType, DeflateStream, State, StaticTreeDesc,
@@ -93,7 +94,7 @@ pub fn deflate_quick(stream: &mut DeflateStream, flush: DeflateFlush) -> BlockSt
9394
}
9495

9596
if state.lookahead >= WANT_MIN_MATCH {
96-
let hash_head = state.quick_insert_string(state.strstart);
97+
let hash_head = StandardHashCalc::quick_insert_string(state, state.strstart);
9798
let dist = state.strstart as isize - hash_head as isize;
9899

99100
if dist <= state.max_dist() as isize && dist > 0 {

0 commit comments

Comments
 (0)