summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko2010-10-27 15:26:45 +0200
committerDenys Vlasenko2010-10-27 15:26:45 +0200
commit9ce642f9746dfc29d119d0680b769677e3ea6da6 (patch)
treef8d2bcd08c691979058b610b32573a742a3e3024 /util-linux
parentdd88ba88f5082b1785539b1fb87af7320515b8c9 (diff)
downloadbusybox-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 'util-linux')
-rw-r--r--util-linux/fdisk_gpt.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
index 98803ec..4dfb5b2 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -46,8 +46,6 @@ static unsigned int n_parts;
static unsigned int part_array_len;
static unsigned int part_entry_len;
-static uint32_t *crc32_table;
-
static inline gpt_partition *
gpt_part(int i)
{
@@ -61,12 +59,7 @@ gpt_part(int i)
static uint32_t
gpt_crc32(void *buf, int len)
{
- uint32_t crc = 0xffffffff;
-
- for (; len > 0; len--, buf++) {
- crc = crc32_table[(crc ^ *((char *)buf)) & 0xff] ^ (crc >> 8);
- }
- return crc ^ 0xffffffff;
+ return 0xffffffff ^ crc32_block_endian0(0xffffffff, buf, len, global_crc32_table);
}
static void
@@ -160,8 +153,8 @@ check_gpt_label(void)
return 0;
}
- if (!crc32_table) {
- crc32_table = crc32_filltable(NULL, 0);
+ if (!global_crc32_table) {
+ global_crc32_table = crc32_filltable(NULL, 0);
}
crc = SWAP_LE32(gpt_hdr->hdr_crc32);