aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-31 16:36:17 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-31 16:36:17 +0100
commit26eea71c87bb5b39fb77eb8b1a6c69ea82e8e879 (patch)
treeeb65a96028511a263ad86721131fcf6f10c31eaa
parent05251986c7c00b07a5a7ff0f70258e53a3f3de9e (diff)
downloadbusybox-w32-26eea71c87bb5b39fb77eb8b1a6c69ea82e8e879.tar.gz
busybox-w32-26eea71c87bb5b39fb77eb8b1a6c69ea82e8e879.tar.bz2
busybox-w32-26eea71c87bb5b39fb77eb8b1a6c69ea82e8e879.zip
gzip: code shrink
function old new delta flush_block 668 665 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/gzip.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index 9dc31e30b..c94fec48d 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -617,8 +617,8 @@ static void copy_block(char *buf, unsigned len, int header)
617 bi_windup(); /* align on byte boundary */ 617 bi_windup(); /* align on byte boundary */
618 618
619 if (header) { 619 if (header) {
620 put_16bit(len); 620 unsigned v = ((uint16_t)len) | ((~len) << 16);
621 put_16bit(~len); 621 put_32bit(v);
622#ifdef DEBUG 622#ifdef DEBUG
623 G1.bits_sent += 2 * 16; 623 G1.bits_sent += 2 * 16;
624#endif 624#endif
@@ -1747,8 +1747,8 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
1747 if (buf == NULL) 1747 if (buf == NULL)
1748 bb_error_msg("block vanished"); 1748 bb_error_msg("block vanished");
1749 1749
1750 copy_block(buf, (unsigned) stored_len, 0); /* without header */
1751 G2.compressed_len = stored_len << 3; 1750 G2.compressed_len = stored_len << 3;
1751 copy_block(buf, (unsigned) stored_len, 0); /* without header */
1752 } else if (stored_len + 4 <= opt_lenb && buf != NULL) { 1752 } else if (stored_len + 4 <= opt_lenb && buf != NULL) {
1753 /* 4: two words for the lengths */ 1753 /* 4: two words for the lengths */
1754 /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. 1754 /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
@@ -1758,9 +1758,8 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
1758 * transform a block into a stored block. 1758 * transform a block into a stored block.
1759 */ 1759 */
1760 send_bits((STORED_BLOCK << 1) + eof, 3); /* send block type */ 1760 send_bits((STORED_BLOCK << 1) + eof, 3); /* send block type */
1761 G2.compressed_len = (G2.compressed_len + 3 + 7) & ~7L; 1761 G2.compressed_len = ((G2.compressed_len + 3 + 7) & ~7L)
1762 G2.compressed_len += (stored_len + 4) << 3; 1762 + ((stored_len + 4) << 3);
1763
1764 copy_block(buf, (unsigned) stored_len, 1); /* with header */ 1763 copy_block(buf, (unsigned) stored_len, 1); /* with header */
1765 } else if (static_lenb == opt_lenb) { 1764 } else if (static_lenb == opt_lenb) {
1766 send_bits((STATIC_TREES << 1) + eof, 3); 1765 send_bits((STATIC_TREES << 1) + eof, 3);