From 3ff04f1bf0bbff1bc9c4f1f41b46f39fd76c920d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 9 Dec 2017 13:09:49 -0500 Subject: [PATCH] Cleanup includes for CRC32 and CRC32C --- crc-simd.cpp | 16 +++++----------- crc.cpp | 13 ++----------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/crc-simd.cpp b/crc-simd.cpp index 2ac8cfb3..2d55e008 100644 --- a/crc-simd.cpp +++ b/crc-simd.cpp @@ -10,23 +10,17 @@ #include "config.h" #include "misc.h" -// We set CRYPTOPP_ARM_CRC32_AVAILABLE based on compiler version. -// If the crc is not available, then we have to disable it here. -// Android does not provide -march=armv8-a+crc or -march=armv8.1-a+crc, so -// it looks like we will have to disable CRC acceleration of their devices. -#if !(defined(__ARM_FEATURE_CRC32) || defined(_MSC_VER)) || defined(__ANDROID__) -# undef CRYPTOPP_ARM_CRC32_AVAILABLE -#endif - #if (CRYPTOPP_SSE42_AVAILABLE) # include #endif #if (CRYPTOPP_ARM_CRC32_AVAILABLE) # include -# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE) -# include -# endif +#endif + +#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE) +# include +# include #endif #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY diff --git a/crc.cpp b/crc.cpp index b7d8046e..c4a4664a 100644 --- a/crc.cpp +++ b/crc.cpp @@ -8,13 +8,6 @@ NAMESPACE_BEGIN(CryptoPP) -// We set CRYPTOPP_ARM_CRC32_AVAILABLE based on compiler version. -// Android does not provide -march=armv8-a+crc or -march=armv8.1-a+crc, so -// it looks like we will have to disable CRC acceleration of their devices. -#if defined(__ANDROID__) -# undef CRYPTOPP_ARM_CRC32_AVAILABLE -#endif - // crc-simd.cpp #if (CRYPTOPP_ARM_CRC32_AVAILABLE) extern void CRC32_Update_ARMV8(const byte *s, size_t n, word32& c); @@ -164,8 +157,7 @@ void CRC32::Update(const byte *s, size_t n) crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); - n -= 4; - s += 4; + n -= 4; s += 4; } while (n--) @@ -330,8 +322,7 @@ void CRC32C::Update(const byte *s, size_t n) crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); - n -= 4; - s += 4; + n -= 4; s += 4; } while (n--)