From f04deff4fc7ffbbcef3a93733c7bb8c51176fc7b Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 6 Jul 2017 01:42:46 -0700 Subject: [PATCH] fixed #718, reported by @GregSlazinski, solution suggested by @mcmilk --- lib/common/zstd_internal.h | 12 ++++++++++++ lib/decompress/zstd_decompress.c | 9 +-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/common/zstd_internal.h b/lib/common/zstd_internal.h index f2c4e624..f49f6a13 100644 --- a/lib/common/zstd_internal.h +++ b/lib/common/zstd_internal.h @@ -331,4 +331,16 @@ size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, ZSTD_parameters ZSTD_getParamsFromCDict(const ZSTD_CDict* cdict); +typedef struct { + blockType_e blockType; + U32 lastBlock; + U32 origSize; +} blockProperties_t; + +/*! ZSTD_getcBlockSize() : +* Provides the size of compressed block from block header `src` */ +size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, + blockProperties_t* bpPtr); + + #endif /* ZSTD_CCOMMON_H_MODULE */ diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 7cb1b3f8..6eca1c47 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -53,7 +53,7 @@ # include "zstd_legacy.h" #endif -#if defined(_MSC_VER) && !defined(_M_IA64) /* _mm_prefetch() is not defined for ia64 */ +#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ # include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # define ZSTD_PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0) #elif defined(__GNUC__) @@ -466,13 +466,6 @@ static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t he } -typedef struct -{ - blockType_e blockType; - U32 lastBlock; - U32 origSize; -} blockProperties_t; - /*! ZSTD_getcBlockSize() : * Provides the size of compressed block from block header `src` */ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize,