Skip to content

Commit 3ff04f1

Browse files
committed
Cleanup includes for CRC32 and CRC32C
1 parent 65222df commit 3ff04f1

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

crc-simd.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,17 @@
1010
#include "config.h"
1111
#include "misc.h"
1212

13-
// We set CRYPTOPP_ARM_CRC32_AVAILABLE based on compiler version.
14-
// If the crc is not available, then we have to disable it here.
15-
// Android does not provide -march=armv8-a+crc or -march=armv8.1-a+crc, so
16-
// it looks like we will have to disable CRC acceleration of their devices.
17-
#if !(defined(__ARM_FEATURE_CRC32) || defined(_MSC_VER)) || defined(__ANDROID__)
18-
# undef CRYPTOPP_ARM_CRC32_AVAILABLE
19-
#endif
20-
2113
#if (CRYPTOPP_SSE42_AVAILABLE)
2214
# include <nmmintrin.h>
2315
#endif
2416

2517
#if (CRYPTOPP_ARM_CRC32_AVAILABLE)
2618
# include <arm_neon.h>
27-
# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
28-
# include <arm_acle.h>
29-
# endif
19+
#endif
20+
21+
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
22+
# include <stdint.h>
23+
# include <arm_acle.h>
3024
#endif
3125

3226
#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY

crc.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88

99
NAMESPACE_BEGIN(CryptoPP)
1010

11-
// We set CRYPTOPP_ARM_CRC32_AVAILABLE based on compiler version.
12-
// Android does not provide -march=armv8-a+crc or -march=armv8.1-a+crc, so
13-
// it looks like we will have to disable CRC acceleration of their devices.
14-
#if defined(__ANDROID__)
15-
# undef CRYPTOPP_ARM_CRC32_AVAILABLE
16-
#endif
17-
1811
// crc-simd.cpp
1912
#if (CRYPTOPP_ARM_CRC32_AVAILABLE)
2013
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)
164157
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
165158
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
166159
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
167-
n -= 4;
168-
s += 4;
160+
n -= 4; s += 4;
169161
}
170162

171163
while (n--)
@@ -330,8 +322,7 @@ void CRC32C::Update(const byte *s, size_t n)
330322
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
331323
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
332324
crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);
333-
n -= 4;
334-
s += 4;
325+
n -= 4; s += 4;
335326
}
336327

337328
while (n--)

0 commit comments

Comments
 (0)