]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Let MSVC force inline ZSTD_hashPtr() function
authoranimalize <malincns@163.com>
Mon, 21 Sep 2020 02:35:47 +0000 (10:35 +0800)
committeranimalize <malincns@163.com>
Mon, 21 Sep 2020 02:38:55 +0000 (10:38 +0800)
ZSTD_hashPtr() function was not expanded by MSVC, led to low performance compared to GCC.

lib/compress/zstd_compress_internal.h

index b161a208cf0c37300440decfac969452ba73d9b2..50673f63aaffbfc42c58cd8cceeacc3c2a8e1dfc 100644 (file)
@@ -647,7 +647,7 @@ static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL;
 static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u) * prime8bytes) >> (64-h)) ; }
 static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h); }
 
-MEM_STATIC size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls)
+FORCE_INLINE_TEMPLATE size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls)
 {
     switch(mls)
     {