diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
commit | 004b98220a30de0d1956a8149d8bc6ec356667da (patch) | |
tree | 1eaee2603984d7ab4524be68b57ce0a2b2b72118 /arch/arm/crc32_acle.c | |
parent | 2ca0d0b38b60e8d6d49a8959bf674a79e7d16f41 (diff) | |
parent | a583e215afa2356e23b418efa871a1cc4348702a (diff) |
Merge tag '2.0.7' into tachibanatachibana-mr1tachibana
Change-Id: I7b03d60d67d184c21ff7437a35062077666951e9
Diffstat (limited to 'arch/arm/crc32_acle.c')
-rw-r--r-- | arch/arm/crc32_acle.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/arch/arm/crc32_acle.c b/arch/arm/crc32_acle.c index 99013e1..0bcd3cf 100644 --- a/arch/arm/crc32_acle.c +++ b/arch/arm/crc32_acle.c @@ -62,7 +62,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) { len--; } - if ((len > sizeof(uint16_t)) && ((ptrdiff_t)buf & sizeof(uint16_t))) { + if ((len >= sizeof(uint16_t)) && ((ptrdiff_t)buf & sizeof(uint16_t))) { buf2 = (const uint16_t *) buf; c = __crc32h(c, *buf2++); len -= sizeof(uint16_t); @@ -72,22 +72,17 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) { } #if defined(__aarch64__) - if ((len > sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) { + if ((len >= sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) { c = __crc32w(c, *buf4++); len -= sizeof(uint32_t); } - const uint64_t *buf8 = (const uint64_t *) buf4; - -#ifdef UNROLL_MORE - while (len >= 4 * sizeof(uint64_t)) { - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - len -= 4 * sizeof(uint64_t); + if (len == 0) { + c = ~c; + return c; } -#endif + + const uint64_t *buf8 = (const uint64_t *) buf4; while (len >= sizeof(uint64_t)) { c = __crc32d(c, *buf8++); @@ -111,19 +106,10 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) { buf = (const unsigned char *) buf2; #else /* __aarch64__ */ -# ifdef UNROLL_MORE - while (len >= 8 * sizeof(uint32_t)) { - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - len -= 8 * sizeof(uint32_t); + if (len == 0) { + c = ~c; + return c; } -# endif while (len >= sizeof(uint32_t)) { c = __crc32w(c, *buf4++); |