From: Yann Collet Date: Thu, 30 Mar 2017 19:52:14 +0000 (-0700) Subject: Changed memory strategy to __packed for gcc X-Git-Tag: v1.2.0^2~69^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F640%2Fhead;p=thirdparty%2Fzstd.git Changed memory strategy to __packed for gcc Method 1 __packed is always as good or better than memcpy(). But it's not portable, as it depends on compiler extension. For gcc, __pakced directive works fine. Furthermore, gcc has serious performance issues with memcpy() on ARM 32 bits. See #620 --- diff --git a/lib/common/mem.h b/lib/common/mem.h index f049d181b..4773a8b93 100644 --- a/lib/common/mem.h +++ b/lib/common/mem.h @@ -89,8 +89,7 @@ MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (size #ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ # 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 MEM_FORCE_MEMORY_ACCESS 2 -# elif defined(__INTEL_COMPILER) /*|| defined(_MSC_VER)*/ || \ - (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 MEM_FORCE_MEMORY_ACCESS 1 # endif #endif