[PATCH 10/13] lib/crc32: Don't perform byte swap for arm64 crc32b

Jiaxun Yang jiaxun.yang at flygoat.com
Sun May 19 14:56:55 CEST 2024


crc32b always calculate results in CPU's native endian,
so there is no need to perform any endian swap.

Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
 lib/crc32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index f36f1763064f..b991e477b31d 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -183,10 +183,9 @@ const uint32_t * ZEXPORT get_crc_table()
 uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 {
 #ifdef CONFIG_ARM64_CRC32
-    crc = cpu_to_le32(crc);
     while (len--)
         crc = __builtin_aarch64_crc32b(crc, *buf++);
-    return le32_to_cpu(crc);
+    return crc;
 #else
     const uint32_t *tab = crc_table;
     const uint32_t *b =(const uint32_t *)buf;

-- 
2.43.0



More information about the U-Boot mailing list