summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-03-30 19:22:17 (GMT)
committerYann Collet <cyan@fb.com>2017-03-30 19:22:17 (GMT)
commite2827775ee80d2ef985858727575df31fc60f1f3 (patch)
tree0f5829b93279e4ac15df00a9ec74f0c27473db15 /lib
parent3d4ee35da4513d2dd00416d7b205f705a6931f35 (diff)
downloadlz4-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
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 4558117..c9c5a07 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -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