From d9395b24fee7a3ed38a09b5aefe137976f35fa12 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Tue, 16 Jan 2024 21:30:35 +0800 Subject: [PATCH] revert --- sse2neon.h | 8 ++++++-- tests/impl.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sse2neon.h b/sse2neon.h index 20b997d8..995c61ec 100644 --- a/sse2neon.h +++ b/sse2neon.h @@ -8500,8 +8500,12 @@ FORCE_INLINE uint32_t _mm_crc32_u8(uint32_t crc, uint8_t v) crc = __crc32cb(crc, v); #else crc ^= v; - for (int bit = 0; bit < 8; bit++) - crc = (crc & 1) ? ((crc >> 1) ^ UINT32_C(0x82f63b78)) : (crc >> 1); + for (int bit = 0; bit < 8; bit++) { + if (crc & 1) + crc = (crc >> 1) ^ UINT32_C(0x82f63b78); + else + crc = (crc >> 1); + } #endif return crc; } diff --git a/tests/impl.cpp b/tests/impl.cpp index 63cc33e0..7414bdcc 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -528,8 +528,12 @@ static inline int16_t saturate_16(int32_t a) uint32_t canonical_crc32_u8(uint32_t crc, uint8_t v) { crc ^= v; - for (int bit = 0; bit < 8; bit++) - crc = (crc & 1) ? ((crc >> 1) ^ uint32_t(0x82f63b78)) : (crc >> 1); + for (int bit = 0; bit < 8; bit++) { + if (crc & 1) + crc = (crc >> 1) ^ UINT32_C(0x82f63b78); + else + crc = (crc >> 1); + } return crc; }