mirror of
https://github.com/facebook/zstd.git
synced 2025-12-12 00:05:03 -05:00
fixed roll buffer lazy2 mode
This commit is contained in:
parent
b7fc88eec7
commit
a85c77b9d3
@ -1581,6 +1581,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
|
|||||||
const U32 repIndex = (U32)(current - offset_1);
|
const U32 repIndex = (U32)(current - offset_1);
|
||||||
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
|
const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
|
||||||
const BYTE* const repMatch = repBase + repIndex;
|
const BYTE* const repMatch = repBase + repIndex;
|
||||||
|
if ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
|
||||||
if (MEM_read32(ip) == MEM_read32(repMatch))
|
if (MEM_read32(ip) == MEM_read32(repMatch))
|
||||||
{
|
{
|
||||||
/* repcode detected */
|
/* repcode detected */
|
||||||
@ -1681,6 +1682,11 @@ size_t ZSTD_compressBlock_lazy_extDict(ZSTD_CCtx* ctx, void* dst, size_t maxDstS
|
|||||||
return ZSTD_compressBlock_lazy_extDict_generic(ctx, dst, maxDstSize, src, srcSize, 0, 1);
|
return ZSTD_compressBlock_lazy_extDict_generic(ctx, dst, maxDstSize, src, srcSize, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ZSTD_compressBlock_lazy2_extDict(ZSTD_CCtx* ctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize)
|
||||||
|
{
|
||||||
|
return ZSTD_compressBlock_lazy_extDict_generic(ctx, dst, maxDstSize, src, srcSize, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef size_t (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
|
typedef size_t (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
|
||||||
|
|
||||||
@ -1698,7 +1704,7 @@ static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int
|
|||||||
case ZSTD_lazy:
|
case ZSTD_lazy:
|
||||||
return ZSTD_compressBlock_lazy_extDict;
|
return ZSTD_compressBlock_lazy_extDict;
|
||||||
case ZSTD_lazy2:
|
case ZSTD_lazy2:
|
||||||
return ZSTD_compressBlock_lazy2;
|
return ZSTD_compressBlock_lazy2_extDict;
|
||||||
case ZSTD_btlazy2:
|
case ZSTD_btlazy2:
|
||||||
return ZSTD_compressBlock_btlazy2;
|
return ZSTD_compressBlock_btlazy2;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user