diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-09-05 13:22:24 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-09-05 13:26:58 +0200 |
commit | 750137ef7ce3d21511b4638d25a4fce0a811b60a (patch) | |
tree | 6082e157a2721af0165b4f07ffdda6b34c0a0547 | |
parent | c660cc1b7714fffbac95c9378ff4b73de650a6de (diff) | |
download | busybox-w32-750137ef7ce3d21511b4638d25a4fce0a811b60a.tar.gz busybox-w32-750137ef7ce3d21511b4638d25a4fce0a811b60a.tar.bz2 busybox-w32-750137ef7ce3d21511b4638d25a4fce0a811b60a.zip |
gzip: code shrink
function old new delta
gzip_main 267 264 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/gzip.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index b08e60efd..3966a06b4 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -259,7 +259,7 @@ enum { | |||
259 | 259 | ||
260 | #if !ENABLE_FEATURE_GZIP_LEVELS | 260 | #if !ENABLE_FEATURE_GZIP_LEVELS |
261 | 261 | ||
262 | comp_level = 6, | 262 | comp_level_minus4 = 6 - 4, |
263 | max_chain_length = 128, | 263 | max_chain_length = 128, |
264 | /* To speed up deflation, hash chains are never searched beyond this length. | 264 | /* To speed up deflation, hash chains are never searched beyond this length. |
265 | * A higher limit improves compression ratio but degrades the speed. | 265 | * A higher limit improves compression ratio but degrades the speed. |
@@ -335,16 +335,16 @@ struct globals { | |||
335 | #define head (G1.prev + WSIZE) /* hash head (see deflate.c) */ | 335 | #define head (G1.prev + WSIZE) /* hash head (see deflate.c) */ |
336 | 336 | ||
337 | #if ENABLE_FEATURE_GZIP_LEVELS | 337 | #if ENABLE_FEATURE_GZIP_LEVELS |
338 | unsigned comp_level; | 338 | unsigned comp_level_minus4; /* can be a byte */ |
339 | unsigned max_chain_length; | 339 | unsigned max_chain_length; |
340 | unsigned max_lazy_match; | 340 | unsigned max_lazy_match; |
341 | unsigned good_match; | 341 | unsigned good_match; |
342 | unsigned nice_match; | 342 | unsigned nice_match; |
343 | #define comp_level (G1.comp_level) | 343 | #define comp_level_minus4 (G1.comp_level_minus4) |
344 | #define max_chain_length (G1.max_chain_length) | 344 | #define max_chain_length (G1.max_chain_length) |
345 | #define max_lazy_match (G1.max_lazy_match) | 345 | #define max_lazy_match (G1.max_lazy_match) |
346 | #define good_match (G1.good_match) | 346 | #define good_match (G1.good_match) |
347 | #define nice_match (G1.nice_match) | 347 | #define nice_match (G1.nice_match) |
348 | #endif | 348 | #endif |
349 | 349 | ||
350 | /* =========================================================================== */ | 350 | /* =========================================================================== */ |
@@ -2082,7 +2082,7 @@ static void zip(void) | |||
2082 | deflate_flags = 0x300; /* extra flags. OS id = 3 (Unix) */ | 2082 | deflate_flags = 0x300; /* extra flags. OS id = 3 (Unix) */ |
2083 | #if ENABLE_FEATURE_GZIP_LEVELS | 2083 | #if ENABLE_FEATURE_GZIP_LEVELS |
2084 | /* Note that comp_level < 4 do not exist in this version of gzip */ | 2084 | /* Note that comp_level < 4 do not exist in this version of gzip */ |
2085 | if (comp_level == 9) { | 2085 | if (comp_level_minus4 == 9 - 4) { |
2086 | deflate_flags |= 0x02; /* SLOW flag */ | 2086 | deflate_flags |= 0x02; /* SLOW flag */ |
2087 | } | 2087 | } |
2088 | #endif | 2088 | #endif |
@@ -2232,7 +2232,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) | |||
2232 | opt = 1 << 5; /* default: 6 */ | 2232 | opt = 1 << 5; /* default: 6 */ |
2233 | opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */ | 2233 | opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */ |
2234 | 2234 | ||
2235 | comp_level = opt + 4; | 2235 | comp_level_minus4 = opt; |
2236 | 2236 | ||
2237 | max_chain_length = 1 << gzip_level_config[opt].chain_shift; | 2237 | max_chain_length = 1 << gzip_level_config[opt].chain_shift; |
2238 | good_match = gzip_level_config[opt].good; | 2238 | good_match = gzip_level_config[opt].good; |