aboutsummaryrefslogtreecommitdiff
path: root/crc32.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2019-02-17 20:45:53 -0800
committerMark Adler <madler@alumni.caltech.edu>2019-02-17 20:49:29 -0800
commitdeb44b57429b05d4ad5b4f793c969e58a9328f06 (patch)
treef436a93bdf2da70196d94d58632fec3ffb58b112 /crc32.c
parent52fc78baf216dac4e76c5eb3bd940f68e87086da (diff)
downloadzlib-deb44b57429b05d4ad5b4f793c969e58a9328f06.tar.gz
zlib-deb44b57429b05d4ad5b4f793c969e58a9328f06.tar.bz2
zlib-deb44b57429b05d4ad5b4f793c969e58a9328f06.zip
Use ARM crc32 instructions if the ARM architecture has them.
The ARM crc32 instructions will be used only if an architecture is explicitly specified at compile time that has those instructions. For example, -march=armv8.1-a or -march=armv8-a+crc, or if the machine being compiled on has the instructions, -march=native.
Diffstat (limited to 'crc32.c')
-rw-r--r--crc32.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/crc32.c b/crc32.c
index 2d20829..7503972 100644
--- a/crc32.c
+++ b/crc32.c
@@ -618,11 +618,15 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
618} 618}
619 619
620/* ========================================================================= 620/* =========================================================================
621 * Use ARM machine instructions if requested. This will compute the CRC about 621 * Use ARM machine instructions if available. This will compute the CRC about
622 * ten times faster than the braided calculation. This code does not check for 622 * ten times faster than the braided calculation. This code does not check for
623 * the presence of the CRC instruction. Compile with care. 623 * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will
624 * only be defined if the compilation specifies an ARM processor architecture
625 * that has the instructions. For example, compiling with -march=armv8.1-a or
626 * -march=armv8-a+crc, or -march=native if the compile machine has the crc32
627 * instructions.
624 */ 628 */
625#if defined(Z_ARM_CRC32) && defined(__aarch64__) && W == 8 629#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
626 630
627/* 631/*
628 Constants empirically determined to maximize speed. These values are from 632 Constants empirically determined to maximize speed. These values are from