Share inffast names in zlib
We use a different set of names in root and contrib directories for the
same purpose.
This patch consolidates the names.
BUG=764431
Change-Id: I346a6f9ab67423b97843346bab6b0c58f516ed1d
Reviewed-on: https://chromium-review.googlesource.com/914469
Commit-Queue: Chris Blume <cblume@chromium.org>
Reviewed-by: Noel Gordon <noel@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#536429}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 46f115f22260093ee7bc2a8764adf64d9c48a612
diff --git a/inffast.c b/inffast.c
index 66c0d02..2797e8a 100644
--- a/inffast.c
+++ b/inffast.c
@@ -18,13 +18,13 @@
available, an end-of-block is encountered, or a data error is encountered.
When large enough input and output buffers are supplied to inflate(), for
example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
+ inflate() execution time is spent in this routine.
Entry assumptions:
state->mode == LEN
- strm->avail_in >= INFLATE_FAST_MIN_HAVE
- strm->avail_out >= INFLATE_FAST_MIN_LEFT
+ strm->avail_in >= INFLATE_FAST_MIN_INPUT (6 bytes)
+ strm->avail_out >= INFLATE_FAST_MIN_OUTPUT (258 bytes)
start >= strm->avail_out
state->bits < 8
@@ -36,16 +36,20 @@
Notes:
+ INFLATE_FAST_MIN_INPUT: 6 bytes
+
- The maximum input bits used by a length/distance pair is 15 bits for the
length code, 5 bits for the length extra, 15 bits for the distance code,
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
Therefore if strm->avail_in >= 6, then there is enough input to avoid
checking for available input while decoding.
+ INFLATE_FAST_MIN_OUTPUT: 258 bytes
+
- The maximum bytes that a single length/distance pair can output is 258
bytes, which is the maximum length that can be coded. inflate_fast()
requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
+ available output space while decoding.
*/
void ZLIB_INTERNAL inflate_fast(strm, start)
z_streamp strm;
@@ -80,10 +84,10 @@
/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
in = strm->next_in;
- last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1));
+ last = in + (strm->avail_in - (INFLATE_FAST_MIN_INPUT - 1));
out = strm->next_out;
beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - (INFLATE_FAST_MIN_LEFT - 1));
+ end = out + (strm->avail_out - (INFLATE_FAST_MIN_OUTPUT - 1));
#ifdef INFLATE_STRICT
dmax = state->dmax;
#endif
@@ -299,11 +303,11 @@
strm->next_in = in;
strm->next_out = out;
strm->avail_in = (unsigned)(in < last ?
- (INFLATE_FAST_MIN_HAVE - 1) + (last - in) :
- (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
+ (INFLATE_FAST_MIN_INPUT - 1) + (last - in) :
+ (INFLATE_FAST_MIN_INPUT - 1) - (in - last));
strm->avail_out = (unsigned)(out < end ?
- (INFLATE_FAST_MIN_LEFT - 1) + (end - out) :
- (INFLATE_FAST_MIN_LEFT - 1) - (out - end));
+ (INFLATE_FAST_MIN_OUTPUT - 1) + (end - out) :
+ (INFLATE_FAST_MIN_OUTPUT - 1) - (out - end));
state->hold = hold;
state->bits = bits;
return;