aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crc32.c')
-rw-r--r--lib/crc32.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/crc32.c b/lib/crc32.c
index a6c9afafc8c8..45b1d67a1767 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -183,21 +183,21 @@ static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p,
183} 183}
184 184
185#if CRC_LE_BITS == 1 185#if CRC_LE_BITS == 1
186u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) 186u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len)
187{ 187{
188 return crc32_le_generic(crc, p, len, NULL, CRC32_POLY_LE); 188 return crc32_le_generic(crc, p, len, NULL, CRC32_POLY_LE);
189} 189}
190u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) 190u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
191{ 191{
192 return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE); 192 return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE);
193} 193}
194#else 194#else
195u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) 195u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len)
196{ 196{
197 return crc32_le_generic(crc, p, len, 197 return crc32_le_generic(crc, p, len,
198 (const u32 (*)[256])crc32table_le, CRC32_POLY_LE); 198 (const u32 (*)[256])crc32table_le, CRC32_POLY_LE);
199} 199}
200u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) 200u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
201{ 201{
202 return crc32_le_generic(crc, p, len, 202 return crc32_le_generic(crc, p, len,
203 (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE); 203 (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
@@ -206,6 +206,9 @@ u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
206EXPORT_SYMBOL(crc32_le); 206EXPORT_SYMBOL(crc32_le);
207EXPORT_SYMBOL(__crc32c_le); 207EXPORT_SYMBOL(__crc32c_le);
208 208
209u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
210u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
211
209/* 212/*
210 * This multiplies the polynomials x and y modulo the given modulus. 213 * This multiplies the polynomials x and y modulo the given modulus.
211 * This follows the "little-endian" CRC convention that the lsbit 214 * This follows the "little-endian" CRC convention that the lsbit