Cleanup includes for CRC32 and CRC32C

This commit is contained in:
Jeffrey Walton 2017-12-09 13:09:49 -05:00
parent 65222dfe9e
commit 3ff04f1bf0
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 7 additions and 22 deletions

View File

@ -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 <nmmintrin.h>
#endif
#if (CRYPTOPP_ARM_CRC32_AVAILABLE)
# include <arm_neon.h>
# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.h>
# endif
#endif
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <stdint.h>
# include <arm_acle.h>
#endif
#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY

13
crc.cpp
View File

@ -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--)