From: W. Felix Handte Date: Tue, 8 Sep 2020 21:39:37 +0000 (-0400) Subject: Attempt to Fix MSVC Warnings X-Git-Tag: v1.4.7~80^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efa33861f27b0339cf4a5238fa1e22fce08717ce;p=thirdparty%2Fzstd.git Attempt to Fix MSVC Warnings --- diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index 898f1c21f..9f11d4ca8 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -497,7 +497,7 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B */ U32 const hashLog = ms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG; U32* const tmpHashTable = hashTable; - U32* const tmpChainTable = hashTable + (1 << hashLog); + U32* const tmpChainTable = hashTable + ((size_t)1 << hashLog); U32 const tmpChainSize = ((1 << ZSTD_LAZY_DDSS_BUCKET_LOG) - 1) << hashLog; U32 const tmpMinChain = tmpChainSize < target ? target - tmpChainSize : idx; @@ -510,7 +510,7 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B /* fill conventional hash table and conventional chain table */ for ( ; idx < target; idx++) { - U32 const h = ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch); + U32 const h = (U32)ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch); if (idx >= tmpMinChain) { tmpChainTable[idx - tmpMinChain] = hashTable[h]; } @@ -579,7 +579,7 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B /* fill the buckets of the hash table */ for (idx = ms->nextToUpdate; idx < target; idx++) { - U32 const h = ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch) + U32 const h = (U32)ZSTD_hashPtr(base + idx, hashLog, ms->cParams.minMatch) << ZSTD_LAZY_DDSS_BUCKET_LOG; U32 i; /* Shift hash cache down 1. */