From: Lucy Phipps Date: Wed, 8 Jun 2022 17:48:19 +0000 (+0100) Subject: early return as requested X-Git-Tag: 2.1.0-beta1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c17bd0a5f3af4f52851e24beebfee2f0d5fc907;p=thirdparty%2Fzlib-ng.git early return as requested --- diff --git a/arch/arm/crc32_acle.c b/arch/arm/crc32_acle.c index 0133e88fb..ce75c343e 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 uint8_t *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 uint8_t *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);