]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix the bug in crc32_acle
authorRichael Zhuang <richael.zhuang@arm.com>
Tue, 6 Feb 2018 05:48:00 +0000 (13:48 +0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 16 Feb 2018 10:33:53 +0000 (11:33 +0100)
On armv8-a platforms if --acle is enabled, zlib-ng will use crc32_acle
instead of the default crc32. However, in crc32_acle the __crc32b() is
used to calculate the crc result of two variables with types uint32_t
and uint64_t, which gives an error result.The correct function used
should be __crc32d().

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
arch/aarch64/crc32_acle.c

index 9c914124c76ec1ab61a95edbfdcbc0b400f3ac49..4e1de9a875534ed9a36e056a43122086dfb5cbb9 100644 (file)
@@ -42,16 +42,16 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, size_t len) {
 
 #ifndef UNROLL_LESS
     while (len >= 32) {
-        c = __crc32b(c, *buf8++);
-        c = __crc32b(c, *buf8++);
-        c = __crc32b(c, *buf8++);
-        c = __crc32b(c, *buf8++);
+        c = __crc32d(c, *buf8++);
+        c = __crc32d(c, *buf8++);
+        c = __crc32d(c, *buf8++);
+        c = __crc32d(c, *buf8++);
         len -= 32;
     }
 #endif
 
     while (len >= 8) {
-        c = __crc32b(c, *buf8++);
+        c = __crc32d(c, *buf8++);
         len -= 8;
     }