From: Yann Collet Date: Fri, 9 Feb 2018 21:10:32 +0000 (-0800) Subject: fixed strict aliasing issue X-Git-Tag: v1.3.4~1^2~39^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=426944c3e31c13e0eecce63983d543f14b5caeb0;p=thirdparty%2Fzstd.git fixed strict aliasing issue tuned threshold --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 3d1f36404..63985933a 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -1394,10 +1394,11 @@ static size_t ZSTD_decompressSequencesLong( static unsigned -ZSTD_shareLongOffsets(const FSE_DTable* offTable) +ZSTD_getLongOffsetsShare(const FSE_DTable* offTable) { - U32 const tableLog = ((const FSE_DTableHeader*)offTable)[0].tableLog; - const FSE_decode_t* table = (const FSE_decode_t*)(offTable + 1); + const void* ptr = offTable; + U32 const tableLog = ((const FSE_DTableHeader*)ptr)[0].tableLog; + const FSE_decode_t* table = ((const FSE_decode_t*)ptr) + 1; U32 const max = 1 << tableLog; U32 u, total = 0; @@ -1442,8 +1443,8 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, srcSize -= seqHSize; if (dctx->fParams.windowSize > (1<<24)) { - U32 const shareLongOffsets = ZSTD_shareLongOffsets(dctx->entropy.OFTable); - U32 const minShare = MEM_64bits() ? 12 : 20; + U32 const shareLongOffsets = ZSTD_getLongOffsetsShare(dctx->entropy.OFTable); + U32 const minShare = MEM_64bits() ? 5 : 13; if (shareLongOffsets >= minShare) return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); }