X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibcrc32c.c;h=b5c3287d8ea47567220cbafd2211dd12b5239356;hb=5cf11daf9abdfd7bf5f5893137155cb38ccbdeb8;hp=52b6dc144ce3376aa70f59bb6cb50bf34689ac47;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=linux-2.6 diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c index 52b6dc144c..b5c3287d8e 100644 --- a/lib/libcrc32c.c +++ b/lib/libcrc32c.c @@ -33,7 +33,6 @@ #include #include #include -#include MODULE_AUTHOR("Clay Haapala "); MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations"); @@ -66,7 +65,7 @@ EXPORT_SYMBOL(crc32c_le); * loop below with crc32 and vary the POLY if we don't find value in terms * of space and maintainability in keeping the two modules separate. */ -u32 __attribute_pure__ +u32 __pure crc32c_le(u32 crc, unsigned char const *p, size_t len) { int i; @@ -88,7 +87,7 @@ crc32c_le(u32 crc, unsigned char const *p, size_t len) * reflect output bytes = true */ -static u32 crc32c_table[256] = { +static const u32 crc32c_table[256] = { 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, 0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, @@ -160,16 +159,14 @@ static u32 crc32c_table[256] = { * crc using table. */ -u32 __attribute_pure__ -crc32c_le(u32 seed, unsigned char const *data, size_t length) +u32 __pure +crc32c_le(u32 crc, unsigned char const *data, size_t length) { - u32 crc = __cpu_to_le32(seed); - while (length--) crc = crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); - return __le32_to_cpu(crc); + return crc; } #endif /* CRC_LE_BITS == 8 */ @@ -177,7 +174,7 @@ crc32c_le(u32 seed, unsigned char const *data, size_t length) EXPORT_SYMBOL(crc32c_be); #if CRC_BE_BITS == 1 -u32 __attribute_pure__ +u32 __pure crc32c_be(u32 crc, unsigned char const *p, size_t len) { int i;