Add ARM special instructions implementation for CRC32.

This commit is contained in:
2021-09-29 02:49:40 +01:00
parent 2458863cb4
commit d433af7987
6 changed files with 101 additions and 1 deletions

10
crc32.h
View File

@@ -276,4 +276,14 @@ AARU_EXPORT void AARU_CALL crc32_free(crc32_ctx* ctx);
#endif
CLMUL uint32_t crc32_clmul(const uint8_t* src, long len, uint32_t initial_crc);
#endif
#if defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("+crc")))
#else // !defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("armv8-a,crc")))
#endif // defined(__aarch64__)
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
TARGET_ARMV8_WITH_CRC uint32_t armv8_crc32_little(uint32_t crc, const unsigned char* buf, uint32_t len);
#endif