forked from madler/zlib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split the hash slide out of fill window
as a preparation to optimize it. "Sliding" happens when the compression window/2 gets moved. In this case the hash values are adapted, which means basically an unsigned subtration with saturation (no wrap at zero). Many processor have an instruction for this, but the compiler, trapped in the C-type systems, is seldomly capable to exploit this.
- Loading branch information
1 parent
906fb03
commit aa30d20
Showing
5 changed files
with
39 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ inflate.c | |
inflate.h | ||
inftrees.c | ||
inftrees.h | ||
slhash.c | ||
trees.c | ||
trees.h | ||
uncompr.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* slhash.c -- slide the hash table during fill_window() | ||
* Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler | ||
* For conditions of distribution and use, see copyright notice in zlib.h | ||
*/ | ||
#include "deflate.h" | ||
#define NIL 0 | ||
|
||
local void update_hoffset(Posf *p, uInt wsize, unsigned n) | ||
{ | ||
register unsigned m; | ||
do { | ||
m = *p; | ||
*p++ = (Pos)(m >= wsize ? m-wsize : NIL); | ||
} while (--n); | ||
} | ||
|
||
void ZLIB_INTERNAL _sh_slide (p, q, wsize, n) | ||
Posf *p; | ||
Posf *q; | ||
uInt wsize; | ||
unsigned n; | ||
{ | ||
update_hoffset(p, wsize, n); | ||
#ifndef FASTEST | ||
/* If n is not on any hash chain, prev[n] is garbage but | ||
* its value will never be used. | ||
*/ | ||
update_hoffset(q, wsize, wsize); | ||
#endif | ||
} |