summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucy Phipps <landfillbaby69@gmail.com>2022-06-08 18:48:19 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2023-03-17 21:27:56 +0100
commit9f017553058e2d3894c42db2434013b1caef606e (patch)
tree0e5b1c8ad6f1751c54ef20428430ccd66d4be335
parentec6ef014ead49ecdb0a2567e2ceea030628ba5ea (diff)
early return as requested
-rw-r--r--arch/arm/crc32_acle.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/crc32_acle.c b/arch/arm/crc32_acle.c
index dc56815..37b1b98 100644
--- a/arch/arm/crc32_acle.c
+++ b/arch/arm/crc32_acle.c
@@ -37,6 +37,11 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
len -= sizeof(uint32_t);
}
+ if (len == 0) {
+ c = ~c;
+ return c;
+ }
+
const uint64_t *buf8 = (const uint64_t *) buf4;
while (len >= sizeof(uint64_t)) {
@@ -61,6 +66,11 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
buf = (const unsigned char *) buf2;
#else /* __aarch64__ */
+ if (len == 0) {
+ c = ~c;
+ return c;
+ }
+
while (len >= sizeof(uint32_t)) {
c = __crc32w(c, *buf4++);
len -= sizeof(uint32_t);