diff options
author | Yann Collet <cyan@fb.com> | 2017-03-30 19:22:17 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-03-30 19:22:17 (GMT) |
commit | e2827775ee80d2ef985858727575df31fc60f1f3 (patch) | |
tree | 0f5829b93279e4ac15df00a9ec74f0c27473db15 | |
parent | 3d4ee35da4513d2dd00416d7b205f705a6931f35 (diff) | |
download | lz4-e2827775ee80d2ef985858727575df31fc60f1f3.zip lz4-e2827775ee80d2ef985858727575df31fc60f1f3.tar.gz lz4-e2827775ee80d2ef985858727575df31fc60f1f3.tar.bz2 |
make __packed memory access default for gcc
It's always as good or better then memcpy()
but depends on gcc-specific extension.
solves https://github.com/facebook/zstd/issues/620
-rw-r--r-- | lib/lz4.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -63,16 +63,15 @@ * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets which generate assembly depending on alignment. + * It can generate buggy code on targets which assembly generation depends on alignment. * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) * See https://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. * Prefer these methods in priority order (0 > 1 > 2) */ -#ifndef LZ4_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ +#ifndef LZ4_FORCE_MEMORY_ACCESS /* can be defined externally */ # if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) # define LZ4_FORCE_MEMORY_ACCESS 2 -# elif defined(__INTEL_COMPILER) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) +# elif defined(__INTEL_COMPILER) || defined(__GNUC__) # define LZ4_FORCE_MEMORY_ACCESS 1 # endif #endif |