diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-02-11 00:26:38 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-02-11 00:26:38 -0800 |
commit | 7d45cf5a1dbe9d34f9fb18e2f485efda83019493 (patch) | |
tree | 290e01d92e398389e83c943ca26e4c9201d3a5bb /inflate.c | |
parent | 1a4ba8cd912466fe538f62d61fbcc25eead6d31a (diff) | |
download | zlib-7d45cf5a1dbe9d34f9fb18e2f485efda83019493.tar.gz zlib-7d45cf5a1dbe9d34f9fb18e2f485efda83019493.tar.bz2 zlib-7d45cf5a1dbe9d34f9fb18e2f485efda83019493.zip |
Use optimized byte swap operations for Microsoft and GNU [Snyder].
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -519,11 +519,6 @@ unsigned out; | |||
519 | bits -= bits & 7; \ | 519 | bits -= bits & 7; \ |
520 | } while (0) | 520 | } while (0) |
521 | 521 | ||
522 | /* Reverse the bytes in a 32-bit value */ | ||
523 | #define REVERSE(q) \ | ||
524 | ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ | ||
525 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) | ||
526 | |||
527 | /* | 522 | /* |
528 | inflate() uses a state machine to process as much input data and generate as | 523 | inflate() uses a state machine to process as much input data and generate as |
529 | much output data as possible before returning. The state machine is | 524 | much output data as possible before returning. The state machine is |
@@ -817,7 +812,7 @@ int flush; | |||
817 | #endif | 812 | #endif |
818 | case DICTID: | 813 | case DICTID: |
819 | NEEDBITS(32); | 814 | NEEDBITS(32); |
820 | strm->adler = state->check = REVERSE(hold); | 815 | strm->adler = state->check = ZSWAP32(hold); |
821 | INITBITS(); | 816 | INITBITS(); |
822 | state->mode = DICT; | 817 | state->mode = DICT; |
823 | case DICT: | 818 | case DICT: |
@@ -1189,7 +1184,7 @@ int flush; | |||
1189 | #ifdef GUNZIP | 1184 | #ifdef GUNZIP |
1190 | state->flags ? hold : | 1185 | state->flags ? hold : |
1191 | #endif | 1186 | #endif |
1192 | REVERSE(hold)) != state->check) { | 1187 | ZSWAP32(hold)) != state->check) { |
1193 | strm->msg = (char *)"incorrect data check"; | 1188 | strm->msg = (char *)"incorrect data check"; |
1194 | state->mode = BAD; | 1189 | state->mode = BAD; |
1195 | break; | 1190 | break; |