diff options
author | Denys Vlasenko | 2010-10-27 15:26:45 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-10-27 15:26:45 +0200 |
commit | 9ce642f9746dfc29d119d0680b769677e3ea6da6 (patch) | |
tree | f8d2bcd08c691979058b610b32573a742a3e3024 /miscutils | |
parent | dd88ba88f5082b1785539b1fb87af7320515b8c9 (diff) | |
download | busybox-9ce642f9746dfc29d119d0680b769677e3ea6da6.zip busybox-9ce642f9746dfc29d119d0680b769677e3ea6da6.tar.gz |
libbb: introduce and use common crc32 routine
function old new delta
crc32_block_endian1 - 37 +37
crc32_block_endian0 - 34 +34
global_crc32_table - 8 +8
file_read 82 87 +5
gzip_main 211 214 +3
xz_crc32 40 35 -5
crc32_table 8 - -8
calculate_gunzip_crc 54 34 -20
lzo_crc32 54 25 -29
cksum_main 298 211 -87
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/4 up/down: 87/-149) Total: -62 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/flash_eraseall.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index 53aad3d..b832cc1 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c @@ -42,15 +42,6 @@ but mtd/jffs2-user.h is gone now (at least 2.6.31.6 does not have it anymore) #define cpu_to_je16(v) ((jint16_t){(v)}) #define cpu_to_je32(v) ((jint32_t){(v)}) -static uint32_t crc32(uint32_t val, const void *ss, int len, - uint32_t *crc32_table) -{ - const unsigned char *s = ss; - while (--len >= 0) - val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8); - return val; -} - static void show_progress(mtd_info_t *meminfo, erase_info_t *erase) { printf("\rErasing %u Kibyte @ %x - %2u%% complete.", @@ -131,8 +122,9 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv) cleanmarker.totlen = cpu_to_je32(8); } - cleanmarker.hdr_crc = cpu_to_je32(crc32(0, &cleanmarker, sizeof(struct jffs2_unknown_node) - 4, - crc32_table)); + cleanmarker.hdr_crc = cpu_to_je32( + crc32_block_endian0(0, &cleanmarker, sizeof(struct jffs2_unknown_node) - 4, crc32_table) + ); } /* Don't want to destroy progress indicator by bb_error_msg's */ |