mirror of
https://github.com/GerbilSoft/zlib-ng.git
synced 2025-06-18 11:35:35 -04:00
Clean up insert_match() in deflate_medium
This commit is contained in:
parent
322753f36e
commit
56d3d9851a
@ -45,10 +45,12 @@ static void insert_match(deflate_state *s, struct match match) {
|
||||
if (UNLIKELY(s->lookahead <= (unsigned int)(match.match_length + WANT_MIN_MATCH)))
|
||||
return;
|
||||
|
||||
/* matches that are not long enough we need to emit as literals */
|
||||
if (LIKELY(match.match_length < WANT_MIN_MATCH)) {
|
||||
/* string at strstart already in table */
|
||||
match.strstart++;
|
||||
match.match_length--;
|
||||
|
||||
/* matches that are not long enough we need to emit as literals */
|
||||
if (LIKELY(match.match_length < WANT_MIN_MATCH - 1)) {
|
||||
if (UNLIKELY(match.match_length > 0)) {
|
||||
if (match.strstart >= match.orgstart) {
|
||||
if (match.strstart + match.match_length - 1 >= match.orgstart) {
|
||||
@ -63,11 +65,7 @@ static void insert_match(deflate_state *s, struct match match) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Insert new strings in the hash table. */
|
||||
if (s->lookahead >= WANT_MIN_MATCH) {
|
||||
match.match_length--; /* string at strstart already in table */
|
||||
match.strstart++;
|
||||
|
||||
/* Insert into hash table. */
|
||||
if (LIKELY(match.strstart >= match.orgstart)) {
|
||||
if (LIKELY(match.strstart + match.match_length - 1 >= match.orgstart)) {
|
||||
insert_string(s, match.strstart, match.match_length);
|
||||
@ -79,17 +77,6 @@ static void insert_match(deflate_state *s, struct match match) {
|
||||
}
|
||||
match.strstart += match.match_length;
|
||||
match.match_length = 0;
|
||||
} else {
|
||||
match.strstart += match.match_length;
|
||||
match.match_length = 0;
|
||||
|
||||
if (match.strstart >= (STD_MIN_MATCH - 2))
|
||||
quick_insert_string(s, match.strstart + 2 - STD_MIN_MATCH);
|
||||
|
||||
/* If lookahead < WANT_MIN_MATCH, ins_h is garbage, but it does not
|
||||
* matter since it will be recomputed at next deflate call.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static void fizzle_matches(deflate_state *s, struct match *current, struct match *next) {
|
||||
|
Loading…
Reference in New Issue
Block a user