libbb: commonalize a bit of little-endian CRC32 table generation code

function                                             old     new   delta
global_crc32_new_table_le                              -      11     +11
crc32_new_table_le                                     -       9      +9
inflate_unzip_internal                               560     556      -4
flash_eraseall_main                                  823     819      -4
unpack_xz_stream                                    2403    2394      -9
lzop_main                                            121     112      -9
gzip_main                                            187     178      -9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/5 up/down: 20/-35)            Total: -15 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2018-02-01 10:56:19 +01:00
parent 06076494da
commit ddacb03e87
8 changed files with 18 additions and 6 deletions

View File

@@ -1000,7 +1000,7 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate)
gunzip_bb = 0;
/* Create the crc table */
gunzip_crc_table = crc32_filltable(NULL, 0);
gunzip_crc_table = crc32_new_table_le();
gunzip_crc = ~0;
error_msg = "corrupted data";

View File

@@ -52,7 +52,7 @@ unpack_xz_stream(transformer_state_t *xstate)
IF_DESKTOP(long long) int total = 0;
if (!global_crc32_table)
global_crc32_table = crc32_filltable(NULL, /*endian:*/ 0);
global_crc32_new_table_le();
memset(&iobuf, 0, sizeof(iobuf));
membuf = xmalloc(2 * BUFSIZ);