#include "crc32.h" #ifdef __aarch64__ #include #endif uint32_t crc32(const uint8_t* input, size_t length){ // #ifdef __aarch64__ // crc32_arm(input,length); // #else uint32_t crc = 0xFFFFFFFFu; while(length--){ crc = lookup[*input++ ^ (crc & 0xFF)] ^ (crc>>8); } return ~crc; // #endif } // #ifdef __aarch64__ // uint32_t crc32_arm(const uint8_t *input, size_t length) { // const uint8_t *bytes = (const uint8_t *)input; // uint32_t crc; // // Process data in blocks of 64 bits (8 bytes) for optimal performance // while (length >= 8) { // crc = __crc32b(crc, *((uint64_t*)bytes)); // bytes += 8; // length -= 8; // } // // Process remaining bytes // while (length--) { // crc = __crc32b(crc, *bytes++); // } // return crc; // } // #endif