summaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-02-11 00:26:38 -0800
committerMark Adler <madler@alumni.caltech.edu>2012-02-11 00:26:38 -0800
commit7d45cf5a1dbe9d34f9fb18e2f485efda83019493 (patch)
tree290e01d92e398389e83c943ca26e4c9201d3a5bb /inflate.c
parent1a4ba8cd912466fe538f62d61fbcc25eead6d31a (diff)
downloadzlib-7d45cf5a1dbe9d34f9fb18e2f485efda83019493.tar.gz
Use optimized byte swap operations for Microsoft and GNU [Snyder].
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/inflate.c b/inflate.c
index 0885c1d..70cd7d9 100644
--- a/inflate.c
+++ b/inflate.c
@@ -519,11 +519,6 @@ unsigned out;
bits -= bits & 7; \
} while (0)
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
/*
inflate() uses a state machine to process as much input data and generate as
much output data as possible before returning. The state machine is
@@ -817,7 +812,7 @@ int flush;
#endif
case DICTID:
NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
+ strm->adler = state->check = ZSWAP32(hold);
INITBITS();
state->mode = DICT;
case DICT:
@@ -1189,7 +1184,7 @@ int flush;
#ifdef GUNZIP
state->flags ? hold :
#endif
- REVERSE(hold)) != state->check) {
+ ZSWAP32(hold)) != state->check) {
strm->msg = (char *)"incorrect data check";
state->mode = BAD;
break;