Clarify and modify ZSTD_Sequence definition

This commit is contained in:
senhuang42 2020-10-27 09:41:32 -04:00
parent f90424da2d
commit 761f40d1c6

View File

@ -1114,21 +1114,24 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params; typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params;
typedef struct { typedef struct {
unsigned int matchPos; /* Match pos in dst */ unsigned int offset; /* The offset of the match.
/* If seqDef.offset > 3, then this is seqDef.offset - 3 * If == 0, then represents a block of literals, determined by litLength
* If seqDef.offset < 3, then this is the corresponding repeat offset */
* But if seqDef.offset < 3 and litLength == 0, this is the
* repeat offset before the corresponding repeat offset unsigned int litLength; /* Literal length */
* And if seqDef.offset == 3 and litLength == 0, this is the unsigned int matchLength; /* Match length. */
* most recent repeat offset - 1 unsigned int rep; /* Represents which repeat offset is used. Ranges from [0, 3].
*/ * If rep == 0, then this sequence does not contain a repeat offset.
unsigned int offset; * Otherwise:
unsigned int litLength; /* Literal length */ * If litLength != 0:
unsigned int matchLength; /* Match length */ * rep == 1 --> offset == repeat offset 1
/* 0 when seq not rep and seqDef.offset otherwise * rep == 2 --> offset == repeat offset 2
* when litLength == 0 this will be <= 4, otherwise <= 3 like normal * rep == 3 --> offset == repeat offset 3
*/ * If litLength == 0:
unsigned int rep; * rep == 1 --> offset == repeat offset 2
* rep == 2 --> offset == repeat offset 3
* rep == 3 --> offset == repeat offset 1 - 1
*/
} ZSTD_Sequence; } ZSTD_Sequence;
typedef struct { typedef struct {