Skip to content

Commit aae267a

Browse files
committed
Reorganize block state
1 parent 887cd4e commit aae267a

File tree

2 files changed

+69
-64
lines changed

2 files changed

+69
-64
lines changed

lib/compress/zstd_compress.c

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize)
8282
cctx->workSpaceSize = workspaceSize - sizeof(ZSTD_CCtx);
8383

8484
/* statically sized space. entropyWorkspace never moves (but prev/next block swap places) */
85-
if (cctx->workSpaceSize < HUF_WORKSPACE_SIZE + 2 * sizeof(ZSTD_blockState_t)) return NULL;
85+
if (cctx->workSpaceSize < HUF_WORKSPACE_SIZE + 2 * sizeof(ZSTD_compressedBlockState_t)) return NULL;
8686
assert(((size_t)cctx->workSpace & (sizeof(void*)-1)) == 0); /* ensure correct alignment */
87-
cctx->prevBlock = (ZSTD_blockState_t*)cctx->workSpace;
88-
cctx->nextBlock = cctx->prevBlock + 1;
87+
cctx->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)cctx->workSpace;
88+
cctx->blockState.nextCBlock = cctx->blockState.prevCBlock + 1;
8989
{
90-
void* const ptr = cctx->nextBlock + 1;
90+
void* const ptr = cctx->blockState.nextCBlock + 1;
9191
cctx->entropyWorkspace = (U32*)ptr;
9292
}
9393
return cctx;
@@ -665,7 +665,7 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params)
665665
0 : MIN(ZSTD_HASHLOG3_MAX, cParams.windowLog);
666666
size_t const h3Size = ((size_t)1) << hashLog3;
667667
size_t const entropySpace = HUF_WORKSPACE_SIZE;
668-
size_t const blockStateSpace = 2 * sizeof(ZSTD_blockState_t);
668+
size_t const blockStateSpace = 2 * sizeof(ZSTD_compressedBlockState_t);
669669
size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
670670

671671
size_t const optBudget =
@@ -799,7 +799,7 @@ static U32 ZSTD_equivalentParams(ZSTD_CCtx_params params1,
799799
ZSTD_sufficientBuff(buffSize1, blockSize1, buffPol2, params2.cParams, pledgedSrcSize);
800800
}
801801

802-
static void ZSTD_resetBlockState(ZSTD_blockState_t* bs)
802+
static void ZSTD_resetBlockState(ZSTD_compressedBlockState_t* bs)
803803
{
804804
int i;
805805
for (i = 0; i < ZSTD_REP_NUM; ++i)
@@ -845,8 +845,8 @@ static size_t ZSTD_continueCCtx(ZSTD_CCtx* cctx, ZSTD_CCtx_params params, U64 pl
845845
(U32)pledgedSrcSize, cctx->appliedParams.fParams.contentSizeFlag);
846846
cctx->stage = ZSTDcs_init;
847847
cctx->dictID = 0;
848-
ZSTD_invalidateMatchState(&cctx->matchState);
849-
ZSTD_resetBlockState(cctx->prevBlock);
848+
ZSTD_invalidateMatchState(&cctx->blockState.matchState);
849+
ZSTD_resetBlockState(cctx->blockState.prevCBlock);
850850
XXH64_reset(&cctx->xxhState, 0);
851851
return 0;
852852
}
@@ -860,6 +860,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
860860
ZSTD_compResetPolicy_e const crp,
861861
ZSTD_buffered_policy_e const zbuff)
862862
{
863+
ZSTD_matchState_t* const ms = &zc->blockState.matchState;
863864
DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u",
864865
(U32)pledgedSrcSize, params.cParams.windowLog);
865866
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
@@ -903,7 +904,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
903904

904905
/* Check if workSpace is large enough, alloc a new one if needed */
905906
{ size_t const entropySpace = HUF_WORKSPACE_SIZE;
906-
size_t const blockStateSpace = 2 * sizeof(ZSTD_blockState_t);
907+
size_t const blockStateSpace = 2 * sizeof(ZSTD_compressedBlockState_t);
907908
size_t const optPotentialSpace = ((MaxML+1) + (MaxLL+1) + (MaxOff+1) + (1<<Litbits)) * sizeof(U32)
908909
+ (ZSTD_OPT_NUM+1) * (sizeof(ZSTD_match_t)+sizeof(ZSTD_optimal_t));
909910
size_t const optSpace = ( (params.cParams.strategy == ZSTD_btopt)
@@ -936,10 +937,10 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
936937

937938
/* Statically sized space. entropyWorkspace never moves (but prev/next block swap places) */
938939
assert(((size_t)zc->workSpace & 3) == 0); /* ensure correct alignment */
939-
assert(zc->workSpaceSize >= 2 * sizeof(ZSTD_blockState_t));
940-
zc->prevBlock = (ZSTD_blockState_t*)zc->workSpace;
941-
zc->nextBlock = zc->prevBlock + 1;
942-
ptr = zc->nextBlock + 1;
940+
assert(zc->workSpaceSize >= 2 * sizeof(ZSTD_compressedBlockState_t));
941+
zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)zc->workSpace;
942+
zc->blockState.nextCBlock = zc->blockState.prevCBlock + 1;
943+
ptr = zc->blockState.nextCBlock + 1;
943944
zc->entropyWorkspace = (U32*)ptr;
944945
} }
945946

@@ -957,19 +958,19 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
957958
zc->stage = ZSTDcs_init;
958959
zc->dictID = 0;
959960

960-
zc->matchState.nextSrc = NULL;
961-
zc->matchState.base = NULL;
962-
zc->matchState.dictBase = NULL;
963-
zc->matchState.hashLog3 = hashLog3;
964-
ZSTD_invalidateMatchState(&zc->matchState);
961+
ms->nextSrc = NULL;
962+
ms->base = NULL;
963+
ms->dictBase = NULL;
964+
ms->hashLog3 = hashLog3;
965+
ZSTD_invalidateMatchState(ms);
965966

966-
ZSTD_resetBlockState(zc->prevBlock);
967+
ZSTD_resetBlockState(zc->blockState.prevCBlock);
967968

968969
ptr = zc->entropyWorkspace + HUF_WORKSPACE_SIZE_U32;
969970

970971
/* opt parser space */
971972
if ((params.cParams.strategy == ZSTD_btopt) | (params.cParams.strategy == ZSTD_btultra)) {
972-
optState_t* opt = &zc->matchState.opt;
973+
optState_t* opt = &zc->blockState.matchState.opt;
973974
DEBUGLOG(4, "reserving optimal parser space");
974975
assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
975976
opt->litFreq = (U32*)ptr;
@@ -997,10 +998,10 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
997998
DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_noMemset);
998999
if (crp!=ZSTDcrp_noMemset) memset(ptr, 0, tableSpace); /* reset tables only */
9991000
assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
1000-
zc->matchState.hashTable = (U32*)(ptr);
1001-
zc->matchState.chainTable = zc->matchState.hashTable + hSize;
1002-
zc->matchState.hashTable3 = zc->matchState.chainTable + chainSize;
1003-
ptr = zc->matchState.hashTable3 + h3Size;
1001+
ms->hashTable = (U32*)(ptr);
1002+
ms->chainTable = ms->hashTable + hSize;
1003+
ms->hashTable3 = ms->chainTable + chainSize;
1004+
ptr = ms->hashTable3 + h3Size;
10041005

10051006
/* sequences storage */
10061007
zc->seqStore.sequencesStart = (seqDef*)ptr;
@@ -1037,8 +1038,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
10371038
* do not use with extDict variant ! */
10381039
void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx) {
10391040
int i;
1040-
for (i=0; i<ZSTD_REP_NUM; i++) cctx->prevBlock->rep[i] = 0;
1041-
assert(/* !extDict */ cctx->matchState.lowLimit == cctx->matchState.dictLimit);
1041+
for (i=0; i<ZSTD_REP_NUM; i++) cctx->blockState.prevCBlock->rep[i] = 0;
1042+
assert(/* !extDict */ cctx->blockState.matchState.lowLimit == cctx->blockState.matchState.dictLimit);
10421043
}
10431044

10441045

@@ -1072,17 +1073,17 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,
10721073
/* copy tables */
10731074
{ size_t const chainSize = (srcCCtx->appliedParams.cParams.strategy == ZSTD_fast) ? 0 : ((size_t)1 << srcCCtx->appliedParams.cParams.chainLog);
10741075
size_t const hSize = (size_t)1 << srcCCtx->appliedParams.cParams.hashLog;
1075-
size_t const h3Size = (size_t)1 << srcCCtx->matchState.hashLog3;
1076+
size_t const h3Size = (size_t)1 << srcCCtx->blockState.matchState.hashLog3;
10761077
size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
1077-
assert((U32*)dstCCtx->matchState.chainTable == (U32*)dstCCtx->matchState.hashTable + hSize); /* chainTable must follow hashTable */
1078-
assert((U32*)dstCCtx->matchState.hashTable3 == (U32*)dstCCtx->matchState.chainTable + chainSize);
1079-
memcpy(dstCCtx->matchState.hashTable, srcCCtx->matchState.hashTable, tableSpace); /* presumes all tables follow each other */
1078+
assert((U32*)dstCCtx->blockState.matchState.chainTable == (U32*)dstCCtx->blockState.matchState.hashTable + hSize); /* chainTable must follow hashTable */
1079+
assert((U32*)dstCCtx->blockState.matchState.hashTable3 == (U32*)dstCCtx->blockState.matchState.chainTable + chainSize);
1080+
memcpy(dstCCtx->blockState.matchState.hashTable, srcCCtx->blockState.matchState.hashTable, tableSpace); /* presumes all tables follow each other */
10801081
}
10811082

10821083
/* copy dictionary offsets */
10831084
{
1084-
ZSTD_matchState_t const* srcMatchState = &srcCCtx->matchState;
1085-
ZSTD_matchState_t* dstMatchState = &dstCCtx->matchState;
1085+
ZSTD_matchState_t const* srcMatchState = &srcCCtx->blockState.matchState;
1086+
ZSTD_matchState_t* dstMatchState = &dstCCtx->blockState.matchState;
10861087
dstMatchState->nextToUpdate = srcMatchState->nextToUpdate;
10871088
dstMatchState->nextToUpdate3= srcMatchState->nextToUpdate3;
10881089
dstMatchState->nextSrc = srcMatchState->nextSrc;
@@ -1095,7 +1096,7 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,
10951096
dstCCtx->dictID = srcCCtx->dictID;
10961097

10971098
/* copy block state */
1098-
memcpy(dstCCtx->prevBlock, srcCCtx->prevBlock, sizeof(*srcCCtx->prevBlock));
1099+
memcpy(dstCCtx->blockState.prevCBlock, srcCCtx->blockState.prevCBlock, sizeof(*srcCCtx->blockState.prevCBlock));
10991100

11001101
return 0;
11011102
}
@@ -1162,7 +1163,7 @@ static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size,
11621163
* rescale all indexes to avoid future overflow (indexes are U32) */
11631164
static void ZSTD_reduceIndex (ZSTD_CCtx* zc, const U32 reducerValue)
11641165
{
1165-
ZSTD_matchState_t* const ms = &zc->matchState;
1166+
ZSTD_matchState_t* const ms = &zc->blockState.matchState;
11661167
{ U32 const hSize = (U32)1 << zc->appliedParams.cParams.hashLog;
11671168
ZSTD_reduceTable(ms->hashTable, hSize, reducerValue);
11681169
}
@@ -1721,35 +1722,35 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
17211722
const void* src, size_t srcSize)
17221723
{
17231724
DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u) (dictLimit=%u, nextToUpdate=%u)",
1724-
(U32)dstCapacity, zc->matchState.dictLimit, zc->matchState.nextToUpdate);
1725+
(U32)dstCapacity, zc->blockState.matchState.dictLimit, zc->blockState.matchState.nextToUpdate);
17251726
if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1)
17261727
return 0; /* don't even attempt compression below a certain srcSize */
17271728
ZSTD_resetSeqStore(&(zc->seqStore));
17281729

17291730
/* limited update after a very long match */
1730-
{ const BYTE* const base = zc->matchState.base;
1731+
{ const BYTE* const base = zc->blockState.matchState.base;
17311732
const BYTE* const istart = (const BYTE*)src;
17321733
const U32 current = (U32)(istart-base);
1733-
if (current > zc->matchState.nextToUpdate + 384)
1734-
zc->matchState.nextToUpdate = current - MIN(192, (U32)(current - zc->matchState.nextToUpdate - 384));
1734+
if (current > zc->blockState.matchState.nextToUpdate + 384)
1735+
zc->blockState.matchState.nextToUpdate = current - MIN(192, (U32)(current - zc->blockState.matchState.nextToUpdate - 384));
17351736
}
17361737
/* find and store sequences */
17371738
{
1738-
U32 const extDict = zc->matchState.lowLimit < zc->matchState.dictLimit;
1739+
U32 const extDict = zc->blockState.matchState.lowLimit < zc->blockState.matchState.dictLimit;
17391740
size_t lastLLSize;
1740-
{ int i; for (i = 0; i < ZSTD_REP_NUM; ++i) zc->nextBlock->rep[i] = zc->prevBlock->rep[i]; }
1741+
{ int i; for (i = 0; i < ZSTD_REP_NUM; ++i) zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i]; }
17411742
if (zc->appliedParams.ldmParams.enableLdm) {
17421743
typedef size_t (*ZSTD_ldmBlockCompressor)(
17431744
ldmState_t* ldms, ZSTD_matchState_t* ms, seqStore_t* seqStore,
17441745
U32 rep[ZSTD_REP_NUM], ZSTD_CCtx_params const* params,
17451746
void const* src, size_t srcSize);
17461747
ZSTD_ldmBlockCompressor const ldmBlockCompressor = extDict ? ZSTD_compressBlock_ldm_extDict : ZSTD_compressBlock_ldm;
17471748

1748-
lastLLSize = ldmBlockCompressor(&zc->ldmState, &zc->matchState, &zc->seqStore, zc->nextBlock->rep, &zc->appliedParams, src, srcSize);
1749+
lastLLSize = ldmBlockCompressor(&zc->ldmState, &zc->blockState.matchState, &zc->seqStore, zc->blockState.nextCBlock->rep, &zc->appliedParams, src, srcSize);
17491750
} else {
17501751
ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, extDict);
17511752

1752-
lastLLSize = blockCompressor(&zc->matchState, &zc->seqStore, zc->nextBlock->rep, &zc->appliedParams.cParams, src, srcSize);
1753+
lastLLSize = blockCompressor(&zc->blockState.matchState, &zc->seqStore, zc->blockState.nextCBlock->rep, &zc->appliedParams.cParams, src, srcSize);
17531754
}
17541755
{
17551756
const BYTE* const anchor = (const BYTE*)src + srcSize - lastLLSize;
@@ -1758,14 +1759,14 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
17581759
}
17591760
/* encode */
17601761
{
1761-
size_t const cSize = ZSTD_compressSequences(&zc->seqStore, &zc->prevBlock->entropy, &zc->nextBlock->entropy, &zc->appliedParams.cParams, dst, dstCapacity, srcSize, zc->entropyWorkspace);
1762+
size_t const cSize = ZSTD_compressSequences(&zc->seqStore, &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, &zc->appliedParams.cParams, dst, dstCapacity, srcSize, zc->entropyWorkspace);
17621763
if (ZSTD_isError(cSize) || cSize == 0)
17631764
return cSize;
17641765
/* confirm repcodes and entropy tables */
17651766
{
1766-
ZSTD_blockState_t* const tmp = zc->prevBlock;
1767-
zc->prevBlock = zc->nextBlock;
1768-
zc->nextBlock = tmp;
1767+
ZSTD_compressedBlockState_t* const tmp = zc->blockState.prevCBlock;
1768+
zc->blockState.prevCBlock = zc->blockState.nextCBlock;
1769+
zc->blockState.nextCBlock = tmp;
17691770
}
17701771
return cSize;
17711772
}
@@ -1797,7 +1798,7 @@ static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx,
17971798
XXH64_update(&cctx->xxhState, src, srcSize);
17981799

17991800
while (remaining) {
1800-
ZSTD_matchState_t* const ms = &cctx->matchState;
1801+
ZSTD_matchState_t* const ms = &cctx->blockState.matchState;
18011802
U32 const lastBlock = lastFrameChunk & (blockSize >= remaining);
18021803

18031804
if (dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE)
@@ -1823,7 +1824,7 @@ static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx,
18231824
*/
18241825
if (ms->lowLimit > (3U<<29)) {
18251826
U32 const cycleMask = ((U32)1 << ZSTD_cycleLog(cctx->appliedParams.cParams.chainLog, cctx->appliedParams.cParams.strategy)) - 1;
1826-
U32 const current = (U32)(ip - cctx->matchState.base);
1827+
U32 const current = (U32)(ip - cctx->blockState.matchState.base);
18271828
U32 const newCurrent = (current & cycleMask) + ((U32)1 << cctx->appliedParams.cParams.windowLog);
18281829
U32 const correction = current - newCurrent;
18291830
ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30);
@@ -1975,7 +1976,7 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,
19751976

19761977
if (!srcSize) return fhSize; /* do not generate an empty block if no input */
19771978

1978-
ZSTD_manageWindowContinuity(&cctx->matchState, src, srcSize);
1979+
ZSTD_manageWindowContinuity(&cctx->blockState.matchState, src, srcSize);
19791980

19801981
DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (U32)cctx->blockSize);
19811982
{ size_t const cSize = frame ?
@@ -2085,7 +2086,7 @@ static size_t ZSTD_checkDictNCount(short* normalizedCounter, unsigned dictMaxSym
20852086
* assumptions : magic number supposed already checked
20862087
* dictSize supposed > 8
20872088
*/
2088-
static size_t ZSTD_loadZstdDictionary(ZSTD_blockState_t* bs, ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* dict, size_t dictSize, void* workspace)
2089+
static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* dict, size_t dictSize, void* workspace)
20892090
{
20902091
const BYTE* dictPtr = (const BYTE*)dict;
20912092
const BYTE* const dictEnd = dictPtr + dictSize;
@@ -2181,12 +2182,12 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_CCtx* cctx,
21812182

21822183
/* dict restricted modes */
21832184
if (dictMode==ZSTD_dm_rawContent)
2184-
return ZSTD_loadDictionaryContent(&cctx->matchState, &cctx->appliedParams, dict, dictSize);
2185+
return ZSTD_loadDictionaryContent(&cctx->blockState.matchState, &cctx->appliedParams, dict, dictSize);
21852186

21862187
if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {
21872188
if (dictMode == ZSTD_dm_auto) {
21882189
DEBUGLOG(4, "raw content dictionary detected");
2189-
return ZSTD_loadDictionaryContent(&cctx->matchState, &cctx->appliedParams, dict, dictSize);
2190+
return ZSTD_loadDictionaryContent(&cctx->blockState.matchState, &cctx->appliedParams, dict, dictSize);
21902191
}
21912192
if (dictMode == ZSTD_dm_fullDict)
21922193
return ERROR(dictionary_wrong);
@@ -2195,7 +2196,7 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_CCtx* cctx,
21952196

21962197
/* dict as full zstd dictionary */
21972198
{
2198-
size_t const dictID = ZSTD_loadZstdDictionary(cctx->prevBlock, &cctx->matchState, &cctx->appliedParams, dict, dictSize, cctx->entropyWorkspace);
2199+
size_t const dictID = ZSTD_loadZstdDictionary(cctx->blockState.prevCBlock, &cctx->blockState.matchState, &cctx->appliedParams, dict, dictSize, cctx->entropyWorkspace);
21992200
if (ZSTD_isError(dictID)) return dictID;
22002201
cctx->dictID = (U32)dictID;
22012202
}

lib/compress/zstd_compress_internal.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ typedef struct {
5757
FSE_repeat litlength_repeatMode;
5858
} ZSTD_entropyCTables_t;
5959

60-
typedef struct {
61-
ZSTD_entropyCTables_t entropy;
62-
U32 rep[ZSTD_REP_NUM];
63-
} ZSTD_blockState_t;
64-
6560
typedef struct {
6661
U32 off;
6762
U32 len;
@@ -98,21 +93,32 @@ typedef struct {
9893
} optState_t;
9994

10095
typedef struct {
101-
BYTE const* nextSrc; /* next block here to continue on current prefix */ /* TODO: Does this belong here? */
96+
ZSTD_entropyCTables_t entropy;
97+
U32 rep[ZSTD_REP_NUM];
98+
} ZSTD_compressedBlockState_t;
99+
100+
typedef struct {
101+
BYTE const* nextSrc; /* next block here to continue on current prefix */
102102
BYTE const* base; /* All regular indexes relative to this position */
103103
BYTE const* dictBase; /* extDict indexes relative to this position */
104104
U32 dictLimit; /* below that point, need extDict */
105105
U32 lowLimit; /* below that point, no more data */
106106
U32 nextToUpdate; /* index from which to continue table update */
107107
U32 nextToUpdate3; /* index from which to continue table update */
108108
U32 hashLog3; /* dispatch table : larger == faster, more memory */
109-
U32 loadedDictEnd; /* index of end of dictionary */ /* TODO: Does this belong here? */
109+
U32 loadedDictEnd; /* index of end of dictionary */
110110
U32* hashTable;
111111
U32* hashTable3;
112112
U32* chainTable;
113113
optState_t opt; /* optimal parser state */
114114
} ZSTD_matchState_t;
115115

116+
typedef struct {
117+
ZSTD_compressedBlockState_t* prevCBlock;
118+
ZSTD_compressedBlockState_t* nextCBlock;
119+
ZSTD_matchState_t matchState;
120+
} ZSTD_blockState_t;
121+
116122
typedef struct {
117123
U32 offset;
118124
U32 checksum;
@@ -171,9 +177,7 @@ struct ZSTD_CCtx_s {
171177

172178
seqStore_t seqStore; /* sequences storage ptrs */
173179
ldmState_t ldmState; /* long distance matching state */
174-
ZSTD_matchState_t matchState;
175-
ZSTD_blockState_t* prevBlock;
176-
ZSTD_blockState_t* nextBlock;
180+
ZSTD_blockState_t blockState;
177181
U32* entropyWorkspace; /* entropy workspace of HUF_WORKSPACE_SIZE bytes */
178182

179183
/* streaming */
@@ -202,7 +206,7 @@ struct ZSTD_CCtx_s {
202206

203207

204208
typedef size_t (*ZSTD_blockCompressor) (
205-
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
209+
ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
206210
ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
207211
ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict);
208212

0 commit comments

Comments
 (0)