From 123fd7943e456f130df6d7587bf95813fab24709 Mon Sep 17 00:00:00 2001 From: Daniel Rubery Date: Wed, 25 Jun 2025 12:52:12 -0700 Subject: [PATCH] Allow users of the SDK to decide about HW-accelerated CRC --- C/7zCrc.c | 7 +++---- C/7zCrc.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C/7zCrc.c b/C/7zCrc.c index 6e2db9e..a9a14f3 100644 --- a/C/7zCrc.c +++ b/C/7zCrc.c @@ -9,7 +9,7 @@ // for debug: // #define __ARM_FEATURE_CRC32 1 -#ifdef __ARM_FEATURE_CRC32 +#if defined(__ARM_FEATURE_CRC32) && !defined(Z7_NO_CRC_HW_FORCE) // #pragma message("__ARM_FEATURE_CRC32") #define Z7_CRC_HW_FORCE #endif @@ -233,17 +233,16 @@ Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER #endif // defined(Z7_CRC_HW_USE) #endif // MY_CPU_LE - - #ifndef Z7_CRC_HW_FORCE +unsigned g_Crc_Algo; + #if defined(Z7_CRC_HW_USE) || defined(Z7_CRC_UPDATE_T1_FUNC_NAME) /* typedef UInt32 (Z7_FASTCALL *Z7_CRC_UPDATE_WITH_TABLE_FUNC) (UInt32 v, const void *data, size_t size, const UInt32 *table); Z7_CRC_UPDATE_WITH_TABLE_FUNC g_CrcUpdate; */ -static unsigned g_Crc_Algo; #if (!defined(MY_CPU_LE) && !defined(MY_CPU_BE)) static unsigned g_Crc_Be; #endif diff --git a/C/7zCrc.h b/C/7zCrc.h index 3e6d408..36d9153 100644 --- a/C/7zCrc.h +++ b/C/7zCrc.h @@ -9,6 +9,7 @@ EXTERN_C_BEGIN extern UInt32 g_CrcTable[]; +extern unsigned g_Crc_Algo; /* Call CrcGenerateTable one time before other CRC functions */ void Z7_FASTCALL CrcGenerateTable(void);