/src/zstd/lib/compress/zstd_compress_internal.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | | * All rights reserved. |
4 | | * |
5 | | * This source code is licensed under both the BSD-style license (found in the |
6 | | * LICENSE file in the root directory of this source tree) and the GPLv2 (found |
7 | | * in the COPYING file in the root directory of this source tree). |
8 | | * You may select, at your option, one of the above-listed licenses. |
9 | | */ |
10 | | |
11 | | /* This header contains definitions |
12 | | * that shall **only** be used by modules within lib/compress. |
13 | | */ |
14 | | |
15 | | #ifndef ZSTD_COMPRESS_H |
16 | | #define ZSTD_COMPRESS_H |
17 | | |
18 | | /*-************************************* |
19 | | * Dependencies |
20 | | ***************************************/ |
21 | | #include "../common/zstd_internal.h" |
22 | | #include "zstd_cwksp.h" |
23 | | #ifdef ZSTD_MULTITHREAD |
24 | | # include "zstdmt_compress.h" |
25 | | #endif |
26 | | #include "../common/bits.h" /* ZSTD_highbit32, ZSTD_NbCommonBytes */ |
27 | | #include "zstd_preSplit.h" /* ZSTD_SLIPBLOCK_WORKSPACESIZE */ |
28 | | |
29 | | /*-************************************* |
30 | | * Constants |
31 | | ***************************************/ |
32 | 384M | #define kSearchStrength 8 |
33 | 11.6M | #define HASH_READ_SIZE 8 |
34 | 348M | #define ZSTD_DUBT_UNSORTED_MARK 1 /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted". |
35 | | It could be confused for a real successor at index "1", if sorted as larger than its predecessor. |
36 | | It's not a big deal though : candidate will just be sorted again. |
37 | | Additionally, candidate position 1 will be lost. |
38 | | But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss. |
39 | | The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table reuse with a different strategy. |
40 | | This constant is required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */ |
41 | | |
42 | | |
43 | | /*-************************************* |
44 | | * Context memory management |
45 | | ***************************************/ |
46 | | typedef enum { ZSTDcs_created=0, ZSTDcs_init, ZSTDcs_ongoing, ZSTDcs_ending } ZSTD_compressionStage_e; |
47 | | typedef enum { zcss_init=0, zcss_load, zcss_flush } ZSTD_cStreamStage; |
48 | | |
49 | | typedef struct ZSTD_prefixDict_s { |
50 | | const void* dict; |
51 | | size_t dictSize; |
52 | | ZSTD_dictContentType_e dictContentType; |
53 | | } ZSTD_prefixDict; |
54 | | |
55 | | typedef struct { |
56 | | void* dictBuffer; |
57 | | void const* dict; |
58 | | size_t dictSize; |
59 | | ZSTD_dictContentType_e dictContentType; |
60 | | ZSTD_CDict* cdict; |
61 | | } ZSTD_localDict; |
62 | | |
63 | | typedef struct { |
64 | | HUF_CElt CTable[HUF_CTABLE_SIZE_ST(255)]; |
65 | | HUF_repeat repeatMode; |
66 | | } ZSTD_hufCTables_t; |
67 | | |
68 | | typedef struct { |
69 | | FSE_CTable offcodeCTable[FSE_CTABLE_SIZE_U32(OffFSELog, MaxOff)]; |
70 | | FSE_CTable matchlengthCTable[FSE_CTABLE_SIZE_U32(MLFSELog, MaxML)]; |
71 | | FSE_CTable litlengthCTable[FSE_CTABLE_SIZE_U32(LLFSELog, MaxLL)]; |
72 | | FSE_repeat offcode_repeatMode; |
73 | | FSE_repeat matchlength_repeatMode; |
74 | | FSE_repeat litlength_repeatMode; |
75 | | } ZSTD_fseCTables_t; |
76 | | |
77 | | typedef struct { |
78 | | ZSTD_hufCTables_t huf; |
79 | | ZSTD_fseCTables_t fse; |
80 | | } ZSTD_entropyCTables_t; |
81 | | |
82 | | /*********************************************** |
83 | | * Sequences * |
84 | | ***********************************************/ |
85 | | typedef struct SeqDef_s { |
86 | | U32 offBase; /* offBase == Offset + ZSTD_REP_NUM, or repcode 1,2,3 */ |
87 | | U16 litLength; |
88 | | U16 mlBase; /* mlBase == matchLength - MINMATCH */ |
89 | | } SeqDef; |
90 | | |
91 | | /* Controls whether seqStore has a single "long" litLength or matchLength. See SeqStore_t. */ |
92 | | typedef enum { |
93 | | ZSTD_llt_none = 0, /* no longLengthType */ |
94 | | ZSTD_llt_literalLength = 1, /* represents a long literal */ |
95 | | ZSTD_llt_matchLength = 2 /* represents a long match */ |
96 | | } ZSTD_longLengthType_e; |
97 | | |
98 | | typedef struct { |
99 | | SeqDef* sequencesStart; |
100 | | SeqDef* sequences; /* ptr to end of sequences */ |
101 | | BYTE* litStart; |
102 | | BYTE* lit; /* ptr to end of literals */ |
103 | | BYTE* llCode; |
104 | | BYTE* mlCode; |
105 | | BYTE* ofCode; |
106 | | size_t maxNbSeq; |
107 | | size_t maxNbLit; |
108 | | |
109 | | /* longLengthPos and longLengthType to allow us to represent either a single litLength or matchLength |
110 | | * in the seqStore that has a value larger than U16 (if it exists). To do so, we increment |
111 | | * the existing value of the litLength or matchLength by 0x10000. |
112 | | */ |
113 | | ZSTD_longLengthType_e longLengthType; |
114 | | U32 longLengthPos; /* Index of the sequence to apply long length modification to */ |
115 | | } SeqStore_t; |
116 | | |
117 | | typedef struct { |
118 | | U32 litLength; |
119 | | U32 matchLength; |
120 | | } ZSTD_SequenceLength; |
121 | | |
122 | | /** |
123 | | * Returns the ZSTD_SequenceLength for the given sequences. It handles the decoding of long sequences |
124 | | * indicated by longLengthPos and longLengthType, and adds MINMATCH back to matchLength. |
125 | | */ |
126 | | MEM_STATIC ZSTD_SequenceLength ZSTD_getSequenceLength(SeqStore_t const* seqStore, SeqDef const* seq) |
127 | 250M | { |
128 | 250M | ZSTD_SequenceLength seqLen; |
129 | 250M | seqLen.litLength = seq->litLength; |
130 | 250M | seqLen.matchLength = seq->mlBase + MINMATCH; |
131 | 250M | if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) { |
132 | 4.60M | if (seqStore->longLengthType == ZSTD_llt_literalLength) { |
133 | 1.12k | seqLen.litLength += 0x10000; |
134 | 1.12k | } |
135 | 4.60M | if (seqStore->longLengthType == ZSTD_llt_matchLength) { |
136 | 5.09k | seqLen.matchLength += 0x10000; |
137 | 5.09k | } |
138 | 4.60M | } |
139 | 250M | return seqLen; |
140 | 250M | } Unexecuted instantiation: sequence_producer.c:ZSTD_getSequenceLength zstd_compress.c:ZSTD_getSequenceLength Line | Count | Source | 127 | 197M | { | 128 | 197M | ZSTD_SequenceLength seqLen; | 129 | 197M | seqLen.litLength = seq->litLength; | 130 | 197M | seqLen.matchLength = seq->mlBase + MINMATCH; | 131 | 197M | if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) { | 132 | 3.45M | if (seqStore->longLengthType == ZSTD_llt_literalLength) { | 133 | 1.12k | seqLen.litLength += 0x10000; | 134 | 1.12k | } | 135 | 3.45M | if (seqStore->longLengthType == ZSTD_llt_matchLength) { | 136 | 5.09k | seqLen.matchLength += 0x10000; | 137 | 5.09k | } | 138 | 3.45M | } | 139 | 197M | return seqLen; | 140 | 197M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_getSequenceLength Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_getSequenceLength zstd_compress_superblock.c:ZSTD_getSequenceLength Line | Count | Source | 127 | 53.3M | { | 128 | 53.3M | ZSTD_SequenceLength seqLen; | 129 | 53.3M | seqLen.litLength = seq->litLength; | 130 | 53.3M | seqLen.matchLength = seq->mlBase + MINMATCH; | 131 | 53.3M | if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) { | 132 | 1.14M | if (seqStore->longLengthType == ZSTD_llt_literalLength) { | 133 | 0 | seqLen.litLength += 0x10000; | 134 | 0 | } | 135 | 1.14M | if (seqStore->longLengthType == ZSTD_llt_matchLength) { | 136 | 0 | seqLen.matchLength += 0x10000; | 137 | 0 | } | 138 | 1.14M | } | 139 | 53.3M | return seqLen; | 140 | 53.3M | } |
Unexecuted instantiation: zstd_double_fast.c:ZSTD_getSequenceLength Unexecuted instantiation: zstd_fast.c:ZSTD_getSequenceLength Unexecuted instantiation: zstd_lazy.c:ZSTD_getSequenceLength Unexecuted instantiation: zstd_ldm.c:ZSTD_getSequenceLength Unexecuted instantiation: zstd_opt.c:ZSTD_getSequenceLength Unexecuted instantiation: zstdmt_compress.c:ZSTD_getSequenceLength Unexecuted instantiation: fastcover.c:ZSTD_getSequenceLength Unexecuted instantiation: zdict.c:ZSTD_getSequenceLength |
141 | | |
142 | | const SeqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */ |
143 | | int ZSTD_seqToCodes(const SeqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */ |
144 | | |
145 | | |
146 | | /*********************************************** |
147 | | * Entropy buffer statistics structs and funcs * |
148 | | ***********************************************/ |
149 | | /** ZSTD_hufCTablesMetadata_t : |
150 | | * Stores Literals Block Type for a super-block in hType, and |
151 | | * huffman tree description in hufDesBuffer. |
152 | | * hufDesSize refers to the size of huffman tree description in bytes. |
153 | | * This metadata is populated in ZSTD_buildBlockEntropyStats_literals() */ |
154 | | typedef struct { |
155 | | SymbolEncodingType_e hType; |
156 | | BYTE hufDesBuffer[ZSTD_MAX_HUF_HEADER_SIZE]; |
157 | | size_t hufDesSize; |
158 | | } ZSTD_hufCTablesMetadata_t; |
159 | | |
160 | | /** ZSTD_fseCTablesMetadata_t : |
161 | | * Stores symbol compression modes for a super-block in {ll, ol, ml}Type, and |
162 | | * fse tables in fseTablesBuffer. |
163 | | * fseTablesSize refers to the size of fse tables in bytes. |
164 | | * This metadata is populated in ZSTD_buildBlockEntropyStats_sequences() */ |
165 | | typedef struct { |
166 | | SymbolEncodingType_e llType; |
167 | | SymbolEncodingType_e ofType; |
168 | | SymbolEncodingType_e mlType; |
169 | | BYTE fseTablesBuffer[ZSTD_MAX_FSE_HEADERS_SIZE]; |
170 | | size_t fseTablesSize; |
171 | | size_t lastCountSize; /* This is to account for bug in 1.3.4. More detail in ZSTD_entropyCompressSeqStore_internal() */ |
172 | | } ZSTD_fseCTablesMetadata_t; |
173 | | |
174 | | typedef struct { |
175 | | ZSTD_hufCTablesMetadata_t hufMetadata; |
176 | | ZSTD_fseCTablesMetadata_t fseMetadata; |
177 | | } ZSTD_entropyCTablesMetadata_t; |
178 | | |
179 | | /** ZSTD_buildBlockEntropyStats() : |
180 | | * Builds entropy for the block. |
181 | | * @return : 0 on success or error code */ |
182 | | size_t ZSTD_buildBlockEntropyStats( |
183 | | const SeqStore_t* seqStorePtr, |
184 | | const ZSTD_entropyCTables_t* prevEntropy, |
185 | | ZSTD_entropyCTables_t* nextEntropy, |
186 | | const ZSTD_CCtx_params* cctxParams, |
187 | | ZSTD_entropyCTablesMetadata_t* entropyMetadata, |
188 | | void* workspace, size_t wkspSize); |
189 | | |
190 | | /********************************* |
191 | | * Compression internals structs * |
192 | | *********************************/ |
193 | | |
194 | | typedef struct { |
195 | | U32 off; /* Offset sumtype code for the match, using ZSTD_storeSeq() format */ |
196 | | U32 len; /* Raw length of match */ |
197 | | } ZSTD_match_t; |
198 | | |
199 | | typedef struct { |
200 | | U32 offset; /* Offset of sequence */ |
201 | | U32 litLength; /* Length of literals prior to match */ |
202 | | U32 matchLength; /* Raw length of match */ |
203 | | } rawSeq; |
204 | | |
205 | | typedef struct { |
206 | | rawSeq* seq; /* The start of the sequences */ |
207 | | size_t pos; /* The index in seq where reading stopped. pos <= size. */ |
208 | | size_t posInSequence; /* The position within the sequence at seq[pos] where reading |
209 | | stopped. posInSequence <= seq[pos].litLength + seq[pos].matchLength */ |
210 | | size_t size; /* The number of sequences. <= capacity. */ |
211 | | size_t capacity; /* The capacity starting from `seq` pointer */ |
212 | | } RawSeqStore_t; |
213 | | |
214 | | UNUSED_ATTR static const RawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0}; |
215 | | |
216 | | typedef struct { |
217 | | int price; /* price from beginning of segment to this position */ |
218 | | U32 off; /* offset of previous match */ |
219 | | U32 mlen; /* length of previous match */ |
220 | | U32 litlen; /* nb of literals since previous match */ |
221 | | U32 rep[ZSTD_REP_NUM]; /* offset history after previous match */ |
222 | | } ZSTD_optimal_t; |
223 | | |
224 | | typedef enum { zop_dynamic=0, zop_predef } ZSTD_OptPrice_e; |
225 | | |
226 | 10.0M | #define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3) |
227 | | typedef struct { |
228 | | /* All tables are allocated inside cctx->workspace by ZSTD_resetCCtx_internal() */ |
229 | | unsigned* litFreq; /* table of literals statistics, of size 256 */ |
230 | | unsigned* litLengthFreq; /* table of litLength statistics, of size (MaxLL+1) */ |
231 | | unsigned* matchLengthFreq; /* table of matchLength statistics, of size (MaxML+1) */ |
232 | | unsigned* offCodeFreq; /* table of offCode statistics, of size (MaxOff+1) */ |
233 | | ZSTD_match_t* matchTable; /* list of found matches, of size ZSTD_OPT_SIZE */ |
234 | | ZSTD_optimal_t* priceTable; /* All positions tracked by optimal parser, of size ZSTD_OPT_SIZE */ |
235 | | |
236 | | U32 litSum; /* nb of literals */ |
237 | | U32 litLengthSum; /* nb of litLength codes */ |
238 | | U32 matchLengthSum; /* nb of matchLength codes */ |
239 | | U32 offCodeSum; /* nb of offset codes */ |
240 | | U32 litSumBasePrice; /* to compare to log2(litfreq) */ |
241 | | U32 litLengthSumBasePrice; /* to compare to log2(llfreq) */ |
242 | | U32 matchLengthSumBasePrice;/* to compare to log2(mlfreq) */ |
243 | | U32 offCodeSumBasePrice; /* to compare to log2(offreq) */ |
244 | | ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow a pre-defined cost structure */ |
245 | | const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */ |
246 | | ZSTD_ParamSwitch_e literalCompressionMode; |
247 | | } optState_t; |
248 | | |
249 | | typedef struct { |
250 | | ZSTD_entropyCTables_t entropy; |
251 | | U32 rep[ZSTD_REP_NUM]; |
252 | | } ZSTD_compressedBlockState_t; |
253 | | |
254 | | typedef struct { |
255 | | BYTE const* nextSrc; /* next block here to continue on current prefix */ |
256 | | BYTE const* base; /* All regular indexes relative to this position */ |
257 | | BYTE const* dictBase; /* extDict indexes relative to this position */ |
258 | | U32 dictLimit; /* below that point, need extDict */ |
259 | | U32 lowLimit; /* below that point, no more valid data */ |
260 | | U32 nbOverflowCorrections; /* Number of times overflow correction has run since |
261 | | * ZSTD_window_init(). Useful for debugging coredumps |
262 | | * and for ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY. |
263 | | */ |
264 | | } ZSTD_window_t; |
265 | | |
266 | 58.8M | #define ZSTD_WINDOW_START_INDEX 2 |
267 | | |
268 | | typedef struct ZSTD_MatchState_t ZSTD_MatchState_t; |
269 | | |
270 | 2.20G | #define ZSTD_ROW_HASH_CACHE_SIZE 8 /* Size of prefetching hash cache for row-based matchfinder */ |
271 | | |
272 | | struct ZSTD_MatchState_t { |
273 | | ZSTD_window_t window; /* State for window round buffer management */ |
274 | | U32 loadedDictEnd; /* index of end of dictionary, within context's referential. |
275 | | * When loadedDictEnd != 0, a dictionary is in use, and still valid. |
276 | | * This relies on a mechanism to set loadedDictEnd=0 when dictionary is no longer within distance. |
277 | | * Such mechanism is provided within ZSTD_window_enforceMaxDist() and ZSTD_checkDictValidity(). |
278 | | * When dict referential is copied into active context (i.e. not attached), |
279 | | * loadedDictEnd == dictSize, since referential starts from zero. |
280 | | */ |
281 | | U32 nextToUpdate; /* index from which to continue table update */ |
282 | | U32 hashLog3; /* dispatch table for matches of len==3 : larger == faster, more memory */ |
283 | | |
284 | | U32 rowHashLog; /* For row-based matchfinder: Hashlog based on nb of rows in the hashTable.*/ |
285 | | BYTE* tagTable; /* For row-based matchFinder: A row-based table containing the hashes and head index. */ |
286 | | U32 hashCache[ZSTD_ROW_HASH_CACHE_SIZE]; /* For row-based matchFinder: a cache of hashes to improve speed */ |
287 | | U64 hashSalt; /* For row-based matchFinder: salts the hash for reuse of tag table */ |
288 | | U32 hashSaltEntropy; /* For row-based matchFinder: collects entropy for salt generation */ |
289 | | |
290 | | U32* hashTable; |
291 | | U32* hashTable3; |
292 | | U32* chainTable; |
293 | | |
294 | | int forceNonContiguous; /* Non-zero if we should force non-contiguous load for the next window update. */ |
295 | | |
296 | | int dedicatedDictSearch; /* Indicates whether this matchState is using the |
297 | | * dedicated dictionary search structure. |
298 | | */ |
299 | | optState_t opt; /* optimal parser state */ |
300 | | const ZSTD_MatchState_t* dictMatchState; |
301 | | ZSTD_compressionParameters cParams; |
302 | | const RawSeqStore_t* ldmSeqStore; |
303 | | |
304 | | /* Controls prefetching in some dictMatchState matchfinders. |
305 | | * This behavior is controlled from the cctx ms. |
306 | | * This parameter has no effect in the cdict ms. */ |
307 | | int prefetchCDictTables; |
308 | | |
309 | | /* When == 0, lazy match finders insert every position. |
310 | | * When != 0, lazy match finders only insert positions they search. |
311 | | * This allows them to skip much faster over incompressible data, |
312 | | * at a small cost to compression ratio. |
313 | | */ |
314 | | int lazySkipping; |
315 | | }; |
316 | | |
317 | | typedef struct { |
318 | | ZSTD_compressedBlockState_t* prevCBlock; |
319 | | ZSTD_compressedBlockState_t* nextCBlock; |
320 | | ZSTD_MatchState_t matchState; |
321 | | } ZSTD_blockState_t; |
322 | | |
323 | | typedef struct { |
324 | | U32 offset; |
325 | | U32 checksum; |
326 | | } ldmEntry_t; |
327 | | |
328 | | typedef struct { |
329 | | BYTE const* split; |
330 | | U32 hash; |
331 | | U32 checksum; |
332 | | ldmEntry_t* bucket; |
333 | | } ldmMatchCandidate_t; |
334 | | |
335 | 148M | #define LDM_BATCH_SIZE 64 |
336 | | |
337 | | typedef struct { |
338 | | ZSTD_window_t window; /* State for the window round buffer management */ |
339 | | ldmEntry_t* hashTable; |
340 | | U32 loadedDictEnd; |
341 | | BYTE* bucketOffsets; /* Next position in bucket to insert entry */ |
342 | | size_t splitIndices[LDM_BATCH_SIZE]; |
343 | | ldmMatchCandidate_t matchCandidates[LDM_BATCH_SIZE]; |
344 | | } ldmState_t; |
345 | | |
346 | | typedef struct { |
347 | | ZSTD_ParamSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */ |
348 | | U32 hashLog; /* Log size of hashTable */ |
349 | | U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */ |
350 | | U32 minMatchLength; /* Minimum match length */ |
351 | | U32 hashRateLog; /* Log number of entries to skip */ |
352 | | U32 windowLog; /* Window log for the LDM */ |
353 | | } ldmParams_t; |
354 | | |
355 | | typedef struct { |
356 | | int collectSequences; |
357 | | ZSTD_Sequence* seqStart; |
358 | | size_t seqIndex; |
359 | | size_t maxSequences; |
360 | | } SeqCollector; |
361 | | |
362 | | struct ZSTD_CCtx_params_s { |
363 | | ZSTD_format_e format; |
364 | | ZSTD_compressionParameters cParams; |
365 | | ZSTD_frameParameters fParams; |
366 | | |
367 | | int compressionLevel; |
368 | | int forceWindow; /* force back-references to respect limit of |
369 | | * 1<<wLog, even for dictionary */ |
370 | | size_t targetCBlockSize; /* Tries to fit compressed block size to be around targetCBlockSize. |
371 | | * No target when targetCBlockSize == 0. |
372 | | * There is no guarantee on compressed block size */ |
373 | | int srcSizeHint; /* User's best guess of source size. |
374 | | * Hint is not valid when srcSizeHint == 0. |
375 | | * There is no guarantee that hint is close to actual source size */ |
376 | | |
377 | | ZSTD_dictAttachPref_e attachDictPref; |
378 | | ZSTD_ParamSwitch_e literalCompressionMode; |
379 | | |
380 | | /* Multithreading: used to pass parameters to mtctx */ |
381 | | int nbWorkers; |
382 | | size_t jobSize; |
383 | | int overlapLog; |
384 | | int rsyncable; |
385 | | |
386 | | /* Long distance matching parameters */ |
387 | | ldmParams_t ldmParams; |
388 | | |
389 | | /* Dedicated dict search algorithm trigger */ |
390 | | int enableDedicatedDictSearch; |
391 | | |
392 | | /* Input/output buffer modes */ |
393 | | ZSTD_bufferMode_e inBufferMode; |
394 | | ZSTD_bufferMode_e outBufferMode; |
395 | | |
396 | | /* Sequence compression API */ |
397 | | ZSTD_SequenceFormat_e blockDelimiters; |
398 | | int validateSequences; |
399 | | |
400 | | /* Block splitting |
401 | | * @postBlockSplitter executes split analysis after sequences are produced, |
402 | | * it's more accurate but consumes more resources. |
403 | | * @preBlockSplitter_level splits before knowing sequences, |
404 | | * it's more approximative but also cheaper. |
405 | | * Valid @preBlockSplitter_level values range from 0 to 6 (included). |
406 | | * 0 means auto, 1 means do not split, |
407 | | * then levels are sorted in increasing cpu budget, from 2 (fastest) to 6 (slowest). |
408 | | * Highest @preBlockSplitter_level combines well with @postBlockSplitter. |
409 | | */ |
410 | | ZSTD_ParamSwitch_e postBlockSplitter; |
411 | | int preBlockSplitter_level; |
412 | | |
413 | | /* Adjust the max block size*/ |
414 | | size_t maxBlockSize; |
415 | | |
416 | | /* Param for deciding whether to use row-based matchfinder */ |
417 | | ZSTD_ParamSwitch_e useRowMatchFinder; |
418 | | |
419 | | /* Always load a dictionary in ext-dict mode (not prefix mode)? */ |
420 | | int deterministicRefPrefix; |
421 | | |
422 | | /* Internal use, for createCCtxParams() and freeCCtxParams() only */ |
423 | | ZSTD_customMem customMem; |
424 | | |
425 | | /* Controls prefetching in some dictMatchState matchfinders */ |
426 | | ZSTD_ParamSwitch_e prefetchCDictTables; |
427 | | |
428 | | /* Controls whether zstd will fall back to an internal matchfinder |
429 | | * if the external matchfinder returns an error code. */ |
430 | | int enableMatchFinderFallback; |
431 | | |
432 | | /* Parameters for the external sequence producer API. |
433 | | * Users set these parameters through ZSTD_registerSequenceProducer(). |
434 | | * It is not possible to set these parameters individually through the public API. */ |
435 | | void* extSeqProdState; |
436 | | ZSTD_sequenceProducer_F extSeqProdFunc; |
437 | | |
438 | | /* Controls repcode search in external sequence parsing */ |
439 | | ZSTD_ParamSwitch_e searchForExternalRepcodes; |
440 | | }; /* typedef'd to ZSTD_CCtx_params within "zstd.h" */ |
441 | | |
442 | | #define COMPRESS_SEQUENCES_WORKSPACE_SIZE (sizeof(unsigned) * (MaxSeq + 2)) |
443 | | #define ENTROPY_WORKSPACE_SIZE (HUF_WORKSPACE_SIZE + COMPRESS_SEQUENCES_WORKSPACE_SIZE) |
444 | 4.39M | #define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE)) |
445 | | |
446 | | /** |
447 | | * Indicates whether this compression proceeds directly from user-provided |
448 | | * source buffer to user-provided destination buffer (ZSTDb_not_buffered), or |
449 | | * whether the context needs to buffer the input/output (ZSTDb_buffered). |
450 | | */ |
451 | | typedef enum { |
452 | | ZSTDb_not_buffered, |
453 | | ZSTDb_buffered |
454 | | } ZSTD_buffered_policy_e; |
455 | | |
456 | | /** |
457 | | * Struct that contains all elements of block splitter that should be allocated |
458 | | * in a wksp. |
459 | | */ |
460 | 77.5k | #define ZSTD_MAX_NB_BLOCK_SPLITS 196 |
461 | | typedef struct { |
462 | | SeqStore_t fullSeqStoreChunk; |
463 | | SeqStore_t firstHalfSeqStore; |
464 | | SeqStore_t secondHalfSeqStore; |
465 | | SeqStore_t currSeqStore; |
466 | | SeqStore_t nextSeqStore; |
467 | | |
468 | | U32 partitions[ZSTD_MAX_NB_BLOCK_SPLITS]; |
469 | | ZSTD_entropyCTablesMetadata_t entropyMetadata; |
470 | | } ZSTD_blockSplitCtx; |
471 | | |
472 | | struct ZSTD_CCtx_s { |
473 | | ZSTD_compressionStage_e stage; |
474 | | int cParamsChanged; /* == 1 if cParams(except wlog) or compression level are changed in requestedParams. Triggers transmission of new params to ZSTDMT (if available) then reset to 0. */ |
475 | | int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ |
476 | | ZSTD_CCtx_params requestedParams; |
477 | | ZSTD_CCtx_params appliedParams; |
478 | | ZSTD_CCtx_params simpleApiParams; /* Param storage used by the simple API - not sticky. Must only be used in top-level simple API functions for storage. */ |
479 | | U32 dictID; |
480 | | size_t dictContentSize; |
481 | | |
482 | | ZSTD_cwksp workspace; /* manages buffer for dynamic allocations */ |
483 | | size_t blockSizeMax; |
484 | | unsigned long long pledgedSrcSizePlusOne; /* this way, 0 (default) == unknown */ |
485 | | unsigned long long consumedSrcSize; |
486 | | unsigned long long producedCSize; |
487 | | XXH64_state_t xxhState; |
488 | | ZSTD_customMem customMem; |
489 | | ZSTD_threadPool* pool; |
490 | | size_t staticSize; |
491 | | SeqCollector seqCollector; |
492 | | int isFirstBlock; |
493 | | int initialized; |
494 | | |
495 | | SeqStore_t seqStore; /* sequences storage ptrs */ |
496 | | ldmState_t ldmState; /* long distance matching state */ |
497 | | rawSeq* ldmSequences; /* Storage for the ldm output sequences */ |
498 | | size_t maxNbLdmSequences; |
499 | | RawSeqStore_t externSeqStore; /* Mutable reference to external sequences */ |
500 | | ZSTD_blockState_t blockState; |
501 | | void* tmpWorkspace; /* used as substitute of stack space - must be aligned for S64 type */ |
502 | | size_t tmpWkspSize; |
503 | | |
504 | | /* Whether we are streaming or not */ |
505 | | ZSTD_buffered_policy_e bufferedPolicy; |
506 | | |
507 | | /* streaming */ |
508 | | char* inBuff; |
509 | | size_t inBuffSize; |
510 | | size_t inToCompress; |
511 | | size_t inBuffPos; |
512 | | size_t inBuffTarget; |
513 | | char* outBuff; |
514 | | size_t outBuffSize; |
515 | | size_t outBuffContentSize; |
516 | | size_t outBuffFlushedSize; |
517 | | ZSTD_cStreamStage streamStage; |
518 | | U32 frameEnded; |
519 | | |
520 | | /* Stable in/out buffer verification */ |
521 | | ZSTD_inBuffer expectedInBuffer; |
522 | | size_t stableIn_notConsumed; /* nb bytes within stable input buffer that are said to be consumed but are not */ |
523 | | size_t expectedOutBufferSize; |
524 | | |
525 | | /* Dictionary */ |
526 | | ZSTD_localDict localDict; |
527 | | const ZSTD_CDict* cdict; |
528 | | ZSTD_prefixDict prefixDict; /* single-usage dictionary */ |
529 | | |
530 | | /* Multi-threading */ |
531 | | #ifdef ZSTD_MULTITHREAD |
532 | | ZSTDMT_CCtx* mtctx; |
533 | | #endif |
534 | | |
535 | | /* Tracing */ |
536 | | #if ZSTD_TRACE |
537 | | ZSTD_TraceCtx traceCtx; |
538 | | #endif |
539 | | |
540 | | /* Workspace for block splitter */ |
541 | | ZSTD_blockSplitCtx blockSplitCtx; |
542 | | |
543 | | /* Buffer for output from external sequence producer */ |
544 | | ZSTD_Sequence* extSeqBuf; |
545 | | size_t extSeqBufCapacity; |
546 | | }; |
547 | | |
548 | | typedef enum { ZSTD_dtlm_fast, ZSTD_dtlm_full } ZSTD_dictTableLoadMethod_e; |
549 | | typedef enum { ZSTD_tfp_forCCtx, ZSTD_tfp_forCDict } ZSTD_tableFillPurpose_e; |
550 | | |
551 | | typedef enum { |
552 | | ZSTD_noDict = 0, |
553 | | ZSTD_extDict = 1, |
554 | | ZSTD_dictMatchState = 2, |
555 | | ZSTD_dedicatedDictSearch = 3 |
556 | | } ZSTD_dictMode_e; |
557 | | |
558 | | typedef enum { |
559 | | ZSTD_cpm_noAttachDict = 0, /* Compression with ZSTD_noDict or ZSTD_extDict. |
560 | | * In this mode we use both the srcSize and the dictSize |
561 | | * when selecting and adjusting parameters. |
562 | | */ |
563 | | ZSTD_cpm_attachDict = 1, /* Compression with ZSTD_dictMatchState or ZSTD_dedicatedDictSearch. |
564 | | * In this mode we only take the srcSize into account when selecting |
565 | | * and adjusting parameters. |
566 | | */ |
567 | | ZSTD_cpm_createCDict = 2, /* Creating a CDict. |
568 | | * In this mode we take both the source size and the dictionary size |
569 | | * into account when selecting and adjusting the parameters. |
570 | | */ |
571 | | ZSTD_cpm_unknown = 3 /* ZSTD_getCParams, ZSTD_getParams, ZSTD_adjustParams. |
572 | | * We don't know what these parameters are for. We default to the legacy |
573 | | * behavior of taking both the source size and the dict size into account |
574 | | * when selecting and adjusting parameters. |
575 | | */ |
576 | | } ZSTD_CParamMode_e; |
577 | | |
578 | | typedef size_t (*ZSTD_BlockCompressor_f) ( |
579 | | ZSTD_MatchState_t* bs, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
580 | | void const* src, size_t srcSize); |
581 | | ZSTD_BlockCompressor_f ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_ParamSwitch_e rowMatchfinderMode, ZSTD_dictMode_e dictMode); |
582 | | |
583 | | |
584 | | MEM_STATIC U32 ZSTD_LLcode(U32 litLength) |
585 | 2.37G | { |
586 | 2.37G | static const BYTE LL_Code[64] = { 0, 1, 2, 3, 4, 5, 6, 7, |
587 | 2.37G | 8, 9, 10, 11, 12, 13, 14, 15, |
588 | 2.37G | 16, 16, 17, 17, 18, 18, 19, 19, |
589 | 2.37G | 20, 20, 20, 20, 21, 21, 21, 21, |
590 | 2.37G | 22, 22, 22, 22, 22, 22, 22, 22, |
591 | 2.37G | 23, 23, 23, 23, 23, 23, 23, 23, |
592 | 2.37G | 24, 24, 24, 24, 24, 24, 24, 24, |
593 | 2.37G | 24, 24, 24, 24, 24, 24, 24, 24 }; |
594 | 2.37G | static const U32 LL_deltaCode = 19; |
595 | 2.37G | return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength]; |
596 | 2.37G | } Unexecuted instantiation: sequence_producer.c:ZSTD_LLcode zstd_compress.c:ZSTD_LLcode Line | Count | Source | 585 | 411M | { | 586 | 411M | static const BYTE LL_Code[64] = { 0, 1, 2, 3, 4, 5, 6, 7, | 587 | 411M | 8, 9, 10, 11, 12, 13, 14, 15, | 588 | 411M | 16, 16, 17, 17, 18, 18, 19, 19, | 589 | 411M | 20, 20, 20, 20, 21, 21, 21, 21, | 590 | 411M | 22, 22, 22, 22, 22, 22, 22, 22, | 591 | 411M | 23, 23, 23, 23, 23, 23, 23, 23, | 592 | 411M | 24, 24, 24, 24, 24, 24, 24, 24, | 593 | 411M | 24, 24, 24, 24, 24, 24, 24, 24 }; | 594 | 411M | static const U32 LL_deltaCode = 19; | 595 | 411M | return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength]; | 596 | 411M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_LLcode Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_LLcode Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_LLcode Unexecuted instantiation: zstd_double_fast.c:ZSTD_LLcode Unexecuted instantiation: zstd_fast.c:ZSTD_LLcode Unexecuted instantiation: zstd_lazy.c:ZSTD_LLcode Unexecuted instantiation: zstd_ldm.c:ZSTD_LLcode Line | Count | Source | 585 | 1.96G | { | 586 | 1.96G | static const BYTE LL_Code[64] = { 0, 1, 2, 3, 4, 5, 6, 7, | 587 | 1.96G | 8, 9, 10, 11, 12, 13, 14, 15, | 588 | 1.96G | 16, 16, 17, 17, 18, 18, 19, 19, | 589 | 1.96G | 20, 20, 20, 20, 21, 21, 21, 21, | 590 | 1.96G | 22, 22, 22, 22, 22, 22, 22, 22, | 591 | 1.96G | 23, 23, 23, 23, 23, 23, 23, 23, | 592 | 1.96G | 24, 24, 24, 24, 24, 24, 24, 24, | 593 | 1.96G | 24, 24, 24, 24, 24, 24, 24, 24 }; | 594 | 1.96G | static const U32 LL_deltaCode = 19; | 595 | 1.96G | return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength]; | 596 | 1.96G | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_LLcode Unexecuted instantiation: fastcover.c:ZSTD_LLcode Unexecuted instantiation: zdict.c:ZSTD_LLcode |
597 | | |
598 | | /* ZSTD_MLcode() : |
599 | | * note : mlBase = matchLength - MINMATCH; |
600 | | * because it's the format it's stored in seqStore->sequences */ |
601 | | MEM_STATIC U32 ZSTD_MLcode(U32 mlBase) |
602 | 5.27G | { |
603 | 5.27G | static const BYTE ML_Code[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
604 | 5.27G | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
605 | 5.27G | 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, |
606 | 5.27G | 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, |
607 | 5.27G | 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, |
608 | 5.27G | 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, |
609 | 5.27G | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, |
610 | 5.27G | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 }; |
611 | 5.27G | static const U32 ML_deltaCode = 36; |
612 | 5.27G | return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase]; |
613 | 5.27G | } Unexecuted instantiation: sequence_producer.c:ZSTD_MLcode zstd_compress.c:ZSTD_MLcode Line | Count | Source | 602 | 411M | { | 603 | 411M | static const BYTE ML_Code[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 604 | 411M | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 605 | 411M | 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, | 606 | 411M | 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, | 607 | 411M | 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, | 608 | 411M | 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, | 609 | 411M | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, | 610 | 411M | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 }; | 611 | 411M | static const U32 ML_deltaCode = 36; | 612 | 411M | return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase]; | 613 | 411M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_MLcode Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_MLcode Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_MLcode Unexecuted instantiation: zstd_double_fast.c:ZSTD_MLcode Unexecuted instantiation: zstd_fast.c:ZSTD_MLcode Unexecuted instantiation: zstd_lazy.c:ZSTD_MLcode Unexecuted instantiation: zstd_ldm.c:ZSTD_MLcode Line | Count | Source | 602 | 4.86G | { | 603 | 4.86G | static const BYTE ML_Code[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 604 | 4.86G | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 605 | 4.86G | 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, | 606 | 4.86G | 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, | 607 | 4.86G | 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, | 608 | 4.86G | 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, | 609 | 4.86G | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, | 610 | 4.86G | 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 }; | 611 | 4.86G | static const U32 ML_deltaCode = 36; | 612 | 4.86G | return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase]; | 613 | 4.86G | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_MLcode Unexecuted instantiation: fastcover.c:ZSTD_MLcode Unexecuted instantiation: zdict.c:ZSTD_MLcode |
614 | | |
615 | | /* ZSTD_cParam_withinBounds: |
616 | | * @return 1 if value is within cParam bounds, |
617 | | * 0 otherwise */ |
618 | | MEM_STATIC int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value) |
619 | 131M | { |
620 | 131M | ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); |
621 | 131M | if (ZSTD_isError(bounds.error)) return 0; |
622 | 131M | if (value < bounds.lowerBound) return 0; |
623 | 131M | if (value > bounds.upperBound) return 0; |
624 | 131M | return 1; |
625 | 131M | } Unexecuted instantiation: sequence_producer.c:ZSTD_cParam_withinBounds zstd_compress.c:ZSTD_cParam_withinBounds Line | Count | Source | 619 | 130M | { | 620 | 130M | ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); | 621 | 130M | if (ZSTD_isError(bounds.error)) return 0; | 622 | 130M | if (value < bounds.lowerBound) return 0; | 623 | 130M | if (value > bounds.upperBound) return 0; | 624 | 130M | return 1; | 625 | 130M | } |
zstd_compress_literals.c:ZSTD_cParam_withinBounds Line | Count | Source | 619 | 1.28M | { | 620 | 1.28M | ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); | 621 | 1.28M | if (ZSTD_isError(bounds.error)) return 0; | 622 | 1.28M | if (value < bounds.lowerBound) return 0; | 623 | 1.28M | if (value > bounds.upperBound) return 0; | 624 | 1.28M | return 1; | 625 | 1.28M | } |
Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_double_fast.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_fast.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_lazy.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_ldm.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstd_opt.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zstdmt_compress.c:ZSTD_cParam_withinBounds Unexecuted instantiation: fastcover.c:ZSTD_cParam_withinBounds Unexecuted instantiation: zdict.c:ZSTD_cParam_withinBounds |
626 | | |
627 | | /* ZSTD_selectAddr: |
628 | | * @return index >= lowLimit ? candidate : backup, |
629 | | * tries to force branchless codegen. */ |
630 | | MEM_STATIC const BYTE* |
631 | | ZSTD_selectAddr(U32 index, U32 lowLimit, const BYTE* candidate, const BYTE* backup) |
632 | 556M | { |
633 | 556M | #if defined(__GNUC__) && defined(__x86_64__) |
634 | 556M | __asm__ ( |
635 | 556M | "cmp %1, %2\n" |
636 | 556M | "cmova %3, %0\n" |
637 | 556M | : "+r"(candidate) |
638 | 556M | : "r"(index), "r"(lowLimit), "r"(backup) |
639 | 556M | ); |
640 | 556M | return candidate; |
641 | | #else |
642 | | return index >= lowLimit ? candidate : backup; |
643 | | #endif |
644 | 556M | } Unexecuted instantiation: sequence_producer.c:ZSTD_selectAddr Unexecuted instantiation: zstd_compress.c:ZSTD_selectAddr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_selectAddr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_selectAddr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_selectAddr zstd_double_fast.c:ZSTD_selectAddr Line | Count | Source | 632 | 426M | { | 633 | 426M | #if defined(__GNUC__) && defined(__x86_64__) | 634 | 426M | __asm__ ( | 635 | 426M | "cmp %1, %2\n" | 636 | 426M | "cmova %3, %0\n" | 637 | 426M | : "+r"(candidate) | 638 | 426M | : "r"(index), "r"(lowLimit), "r"(backup) | 639 | 426M | ); | 640 | 426M | return candidate; | 641 | | #else | 642 | | return index >= lowLimit ? candidate : backup; | 643 | | #endif | 644 | 426M | } |
zstd_fast.c:ZSTD_selectAddr Line | Count | Source | 632 | 129M | { | 633 | 129M | #if defined(__GNUC__) && defined(__x86_64__) | 634 | 129M | __asm__ ( | 635 | 129M | "cmp %1, %2\n" | 636 | 129M | "cmova %3, %0\n" | 637 | 129M | : "+r"(candidate) | 638 | 129M | : "r"(index), "r"(lowLimit), "r"(backup) | 639 | 129M | ); | 640 | 129M | return candidate; | 641 | | #else | 642 | | return index >= lowLimit ? candidate : backup; | 643 | | #endif | 644 | 129M | } |
Unexecuted instantiation: zstd_lazy.c:ZSTD_selectAddr Unexecuted instantiation: zstd_ldm.c:ZSTD_selectAddr Unexecuted instantiation: zstd_opt.c:ZSTD_selectAddr Unexecuted instantiation: zstdmt_compress.c:ZSTD_selectAddr Unexecuted instantiation: fastcover.c:ZSTD_selectAddr Unexecuted instantiation: zdict.c:ZSTD_selectAddr |
645 | | |
646 | | /* ZSTD_noCompressBlock() : |
647 | | * Writes uncompressed block to dst buffer from given src. |
648 | | * Returns the size of the block */ |
649 | | MEM_STATIC size_t |
650 | | ZSTD_noCompressBlock(void* dst, size_t dstCapacity, const void* src, size_t srcSize, U32 lastBlock) |
651 | 51.9M | { |
652 | 51.9M | U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw)<<1) + (U32)(srcSize << 3); |
653 | 51.9M | DEBUGLOG(5, "ZSTD_noCompressBlock (srcSize=%zu, dstCapacity=%zu)", srcSize, dstCapacity); |
654 | 51.9M | RETURN_ERROR_IF(srcSize + ZSTD_blockHeaderSize > dstCapacity, |
655 | 51.9M | dstSize_tooSmall, "dst buf too small for uncompressed block"); |
656 | 51.9M | MEM_writeLE24(dst, cBlockHeader24); |
657 | 51.9M | ZSTD_memcpy((BYTE*)dst + ZSTD_blockHeaderSize, src, srcSize); |
658 | 51.9M | return ZSTD_blockHeaderSize + srcSize; |
659 | 51.9M | } Unexecuted instantiation: sequence_producer.c:ZSTD_noCompressBlock zstd_compress.c:ZSTD_noCompressBlock Line | Count | Source | 651 | 51.8M | { | 652 | 51.8M | U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw)<<1) + (U32)(srcSize << 3); | 653 | 51.8M | DEBUGLOG(5, "ZSTD_noCompressBlock (srcSize=%zu, dstCapacity=%zu)", srcSize, dstCapacity); | 654 | 51.8M | RETURN_ERROR_IF(srcSize + ZSTD_blockHeaderSize > dstCapacity, | 655 | 51.8M | dstSize_tooSmall, "dst buf too small for uncompressed block"); | 656 | 51.8M | MEM_writeLE24(dst, cBlockHeader24); | 657 | 51.8M | ZSTD_memcpy((BYTE*)dst + ZSTD_blockHeaderSize, src, srcSize); | 658 | 51.8M | return ZSTD_blockHeaderSize + srcSize; | 659 | 51.8M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_noCompressBlock Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_noCompressBlock zstd_compress_superblock.c:ZSTD_noCompressBlock Line | Count | Source | 651 | 123k | { | 652 | 123k | U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw)<<1) + (U32)(srcSize << 3); | 653 | 123k | DEBUGLOG(5, "ZSTD_noCompressBlock (srcSize=%zu, dstCapacity=%zu)", srcSize, dstCapacity); | 654 | 123k | RETURN_ERROR_IF(srcSize + ZSTD_blockHeaderSize > dstCapacity, | 655 | 123k | dstSize_tooSmall, "dst buf too small for uncompressed block"); | 656 | 123k | MEM_writeLE24(dst, cBlockHeader24); | 657 | 123k | ZSTD_memcpy((BYTE*)dst + ZSTD_blockHeaderSize, src, srcSize); | 658 | 123k | return ZSTD_blockHeaderSize + srcSize; | 659 | 123k | } |
Unexecuted instantiation: zstd_double_fast.c:ZSTD_noCompressBlock Unexecuted instantiation: zstd_fast.c:ZSTD_noCompressBlock Unexecuted instantiation: zstd_lazy.c:ZSTD_noCompressBlock Unexecuted instantiation: zstd_ldm.c:ZSTD_noCompressBlock Unexecuted instantiation: zstd_opt.c:ZSTD_noCompressBlock Unexecuted instantiation: zstdmt_compress.c:ZSTD_noCompressBlock Unexecuted instantiation: fastcover.c:ZSTD_noCompressBlock Unexecuted instantiation: zdict.c:ZSTD_noCompressBlock |
660 | | |
661 | | MEM_STATIC size_t |
662 | | ZSTD_rleCompressBlock(void* dst, size_t dstCapacity, BYTE src, size_t srcSize, U32 lastBlock) |
663 | 133k | { |
664 | 133k | BYTE* const op = (BYTE*)dst; |
665 | 133k | U32 const cBlockHeader = lastBlock + (((U32)bt_rle)<<1) + (U32)(srcSize << 3); |
666 | 133k | RETURN_ERROR_IF(dstCapacity < 4, dstSize_tooSmall, ""); |
667 | 133k | MEM_writeLE24(op, cBlockHeader); |
668 | 133k | op[3] = src; |
669 | 133k | return 4; |
670 | 133k | } Unexecuted instantiation: sequence_producer.c:ZSTD_rleCompressBlock zstd_compress.c:ZSTD_rleCompressBlock Line | Count | Source | 663 | 133k | { | 664 | 133k | BYTE* const op = (BYTE*)dst; | 665 | 133k | U32 const cBlockHeader = lastBlock + (((U32)bt_rle)<<1) + (U32)(srcSize << 3); | 666 | 133k | RETURN_ERROR_IF(dstCapacity < 4, dstSize_tooSmall, ""); | 667 | 133k | MEM_writeLE24(op, cBlockHeader); | 668 | 133k | op[3] = src; | 669 | 133k | return 4; | 670 | 133k | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_double_fast.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_fast.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_lazy.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_ldm.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstd_opt.c:ZSTD_rleCompressBlock Unexecuted instantiation: zstdmt_compress.c:ZSTD_rleCompressBlock Unexecuted instantiation: fastcover.c:ZSTD_rleCompressBlock Unexecuted instantiation: zdict.c:ZSTD_rleCompressBlock |
671 | | |
672 | | |
673 | | /* ZSTD_minGain() : |
674 | | * minimum compression required |
675 | | * to generate a compress block or a compressed literals section. |
676 | | * note : use same formula for both situations */ |
677 | | MEM_STATIC size_t ZSTD_minGain(size_t srcSize, ZSTD_strategy strat) |
678 | 5.78M | { |
679 | 5.78M | U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6; |
680 | 5.78M | ZSTD_STATIC_ASSERT(ZSTD_btultra == 8); |
681 | 5.78M | assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat)); |
682 | 5.78M | return (srcSize >> minlog) + 2; |
683 | 5.78M | } Unexecuted instantiation: sequence_producer.c:ZSTD_minGain zstd_compress.c:ZSTD_minGain Line | Count | Source | 678 | 4.49M | { | 679 | 4.49M | U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6; | 680 | 4.49M | ZSTD_STATIC_ASSERT(ZSTD_btultra == 8); | 681 | 4.49M | assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat)); | 682 | 4.49M | return (srcSize >> minlog) + 2; | 683 | 4.49M | } |
zstd_compress_literals.c:ZSTD_minGain Line | Count | Source | 678 | 1.28M | { | 679 | 1.28M | U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6; | 680 | 1.28M | ZSTD_STATIC_ASSERT(ZSTD_btultra == 8); | 681 | 1.28M | assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat)); | 682 | 1.28M | return (srcSize >> minlog) + 2; | 683 | 1.28M | } |
Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_minGain Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_minGain Unexecuted instantiation: zstd_double_fast.c:ZSTD_minGain Unexecuted instantiation: zstd_fast.c:ZSTD_minGain Unexecuted instantiation: zstd_lazy.c:ZSTD_minGain Unexecuted instantiation: zstd_ldm.c:ZSTD_minGain Unexecuted instantiation: zstd_opt.c:ZSTD_minGain Unexecuted instantiation: zstdmt_compress.c:ZSTD_minGain Unexecuted instantiation: fastcover.c:ZSTD_minGain Unexecuted instantiation: zdict.c:ZSTD_minGain |
684 | | |
685 | | MEM_STATIC int ZSTD_literalsCompressionIsDisabled(const ZSTD_CCtx_params* cctxParams) |
686 | 4.74M | { |
687 | 4.74M | switch (cctxParams->literalCompressionMode) { |
688 | 811k | case ZSTD_ps_enable: |
689 | 811k | return 0; |
690 | 390k | case ZSTD_ps_disable: |
691 | 390k | return 1; |
692 | 0 | default: |
693 | 0 | assert(0 /* impossible: pre-validated */); |
694 | 0 | ZSTD_FALLTHROUGH; |
695 | 3.54M | case ZSTD_ps_auto: |
696 | 3.54M | return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); |
697 | 4.74M | } |
698 | 4.74M | } Unexecuted instantiation: sequence_producer.c:ZSTD_literalsCompressionIsDisabled zstd_compress.c:ZSTD_literalsCompressionIsDisabled Line | Count | Source | 686 | 4.74M | { | 687 | 4.74M | switch (cctxParams->literalCompressionMode) { | 688 | 811k | case ZSTD_ps_enable: | 689 | 811k | return 0; | 690 | 390k | case ZSTD_ps_disable: | 691 | 390k | return 1; | 692 | 0 | default: | 693 | 0 | assert(0 /* impossible: pre-validated */); | 694 | 0 | ZSTD_FALLTHROUGH; | 695 | 3.54M | case ZSTD_ps_auto: | 696 | 3.54M | return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); | 697 | 4.74M | } | 698 | 4.74M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_double_fast.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_fast.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_lazy.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_ldm.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstd_opt.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zstdmt_compress.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: fastcover.c:ZSTD_literalsCompressionIsDisabled Unexecuted instantiation: zdict.c:ZSTD_literalsCompressionIsDisabled |
699 | | |
700 | | /*! ZSTD_safecopyLiterals() : |
701 | | * memcpy() function that won't read beyond more than WILDCOPY_OVERLENGTH bytes past ilimit_w. |
702 | | * Only called when the sequence ends past ilimit_w, so it only needs to be optimized for single |
703 | | * large copies. |
704 | | */ |
705 | | static void |
706 | | ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE const* ilimit_w) |
707 | 8.02M | { |
708 | 8.02M | assert(iend > ilimit_w); |
709 | 8.02M | if (ip <= ilimit_w) { |
710 | 656k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); |
711 | 656k | op += ilimit_w - ip; |
712 | 656k | ip = ilimit_w; |
713 | 656k | } |
714 | 18.9M | while (ip < iend) *op++ = *ip++; |
715 | 8.02M | } Unexecuted instantiation: sequence_producer.c:ZSTD_safecopyLiterals zstd_compress.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 1.94M | { | 708 | 1.94M | assert(iend > ilimit_w); | 709 | 1.94M | if (ip <= ilimit_w) { | 710 | 71.3k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 71.3k | op += ilimit_w - ip; | 712 | 71.3k | ip = ilimit_w; | 713 | 71.3k | } | 714 | 3.21M | while (ip < iend) *op++ = *ip++; | 715 | 1.94M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_safecopyLiterals Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_safecopyLiterals Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_safecopyLiterals zstd_double_fast.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 1.58M | { | 708 | 1.58M | assert(iend > ilimit_w); | 709 | 1.58M | if (ip <= ilimit_w) { | 710 | 164k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 164k | op += ilimit_w - ip; | 712 | 164k | ip = ilimit_w; | 713 | 164k | } | 714 | 4.60M | while (ip < iend) *op++ = *ip++; | 715 | 1.58M | } |
zstd_fast.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 1.77M | { | 708 | 1.77M | assert(iend > ilimit_w); | 709 | 1.77M | if (ip <= ilimit_w) { | 710 | 105k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 105k | op += ilimit_w - ip; | 712 | 105k | ip = ilimit_w; | 713 | 105k | } | 714 | 3.43M | while (ip < iend) *op++ = *ip++; | 715 | 1.77M | } |
zstd_lazy.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 1.85M | { | 708 | 1.85M | assert(iend > ilimit_w); | 709 | 1.85M | if (ip <= ilimit_w) { | 710 | 213k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 213k | op += ilimit_w - ip; | 712 | 213k | ip = ilimit_w; | 713 | 213k | } | 714 | 5.19M | while (ip < iend) *op++ = *ip++; | 715 | 1.85M | } |
zstd_ldm.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 118k | { | 708 | 118k | assert(iend > ilimit_w); | 709 | 118k | if (ip <= ilimit_w) { | 710 | 25.2k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 25.2k | op += ilimit_w - ip; | 712 | 25.2k | ip = ilimit_w; | 713 | 25.2k | } | 714 | 463k | while (ip < iend) *op++ = *ip++; | 715 | 118k | } |
zstd_opt.c:ZSTD_safecopyLiterals Line | Count | Source | 707 | 748k | { | 708 | 748k | assert(iend > ilimit_w); | 709 | 748k | if (ip <= ilimit_w) { | 710 | 76.0k | ZSTD_wildcopy(op, ip, (size_t)(ilimit_w - ip), ZSTD_no_overlap); | 711 | 76.0k | op += ilimit_w - ip; | 712 | 76.0k | ip = ilimit_w; | 713 | 76.0k | } | 714 | 2.05M | while (ip < iend) *op++ = *ip++; | 715 | 748k | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_safecopyLiterals Unexecuted instantiation: fastcover.c:ZSTD_safecopyLiterals Unexecuted instantiation: zdict.c:ZSTD_safecopyLiterals |
716 | | |
717 | | |
718 | 437M | #define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1) |
719 | | #define REPCODE2_TO_OFFBASE REPCODE_TO_OFFBASE(2) |
720 | 84.5k | #define REPCODE3_TO_OFFBASE REPCODE_TO_OFFBASE(3) |
721 | 615M | #define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */ |
722 | 618M | #define OFFSET_TO_OFFBASE(o) (assert((o)>0), o + ZSTD_REP_NUM) |
723 | 498M | #define OFFBASE_IS_OFFSET(o) ((o) > ZSTD_REP_NUM) |
724 | 34.6M | #define OFFBASE_IS_REPCODE(o) ( 1 <= (o) && (o) <= ZSTD_REP_NUM) |
725 | 345M | #define OFFBASE_TO_OFFSET(o) (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM) |
726 | 248M | #define OFFBASE_TO_REPCODE(o) (assert(OFFBASE_IS_REPCODE(o)), (o)) /* returns ID 1,2,3 */ |
727 | | |
728 | | /*! ZSTD_storeSeqOnly() : |
729 | | * Store a sequence (litlen, litPtr, offBase and matchLength) into SeqStore_t. |
730 | | * Literals themselves are not copied, but @litPtr is updated. |
731 | | * @offBase : Users should employ macros REPCODE_TO_OFFBASE() and OFFSET_TO_OFFBASE(). |
732 | | * @matchLength : must be >= MINMATCH |
733 | | */ |
734 | | HINT_INLINE UNUSED_ATTR void |
735 | | ZSTD_storeSeqOnly(SeqStore_t* seqStorePtr, |
736 | | size_t litLength, |
737 | | U32 offBase, |
738 | | size_t matchLength) |
739 | 242M | { |
740 | 242M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); |
741 | | |
742 | | /* literal Length */ |
743 | 242M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); |
744 | 242M | if (UNLIKELY(litLength>0xFFFF)) { |
745 | 2.04k | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ |
746 | 2.04k | seqStorePtr->longLengthType = ZSTD_llt_literalLength; |
747 | 2.04k | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); |
748 | 2.04k | } |
749 | 242M | seqStorePtr->sequences[0].litLength = (U16)litLength; |
750 | | |
751 | | /* match offset */ |
752 | 242M | seqStorePtr->sequences[0].offBase = offBase; |
753 | | |
754 | | /* match Length */ |
755 | 242M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); |
756 | 242M | assert(matchLength >= MINMATCH); |
757 | 242M | { size_t const mlBase = matchLength - MINMATCH; |
758 | 242M | if (UNLIKELY(mlBase>0xFFFF)) { |
759 | 5.90k | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ |
760 | 5.90k | seqStorePtr->longLengthType = ZSTD_llt_matchLength; |
761 | 5.90k | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); |
762 | 5.90k | } |
763 | 242M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; |
764 | 242M | } |
765 | | |
766 | 0 | seqStorePtr->sequences++; |
767 | 242M | } Unexecuted instantiation: sequence_producer.c:ZSTD_storeSeqOnly zstd_compress.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 37.2M | { | 740 | 37.2M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 37.2M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 37.2M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 914 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 914 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 914 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 914 | } | 749 | 37.2M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 37.2M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 37.2M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 37.2M | assert(matchLength >= MINMATCH); | 757 | 37.2M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 37.2M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 756 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 756 | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 756 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 756 | } | 763 | 37.2M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 37.2M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 37.2M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_storeSeqOnly Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_storeSeqOnly Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_storeSeqOnly zstd_double_fast.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 31.3M | { | 740 | 31.3M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 31.3M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 31.3M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 216 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 216 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 216 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 216 | } | 749 | 31.3M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 31.3M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 31.3M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 31.3M | assert(matchLength >= MINMATCH); | 757 | 31.3M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 31.3M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 1.61k | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 1.61k | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 1.61k | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 1.61k | } | 763 | 31.3M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 31.3M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 31.3M | } |
zstd_fast.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 48.7M | { | 740 | 48.7M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 48.7M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 48.7M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 641 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 641 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 641 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 641 | } | 749 | 48.7M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 48.7M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 48.7M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 48.7M | assert(matchLength >= MINMATCH); | 757 | 48.7M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 48.7M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 1.79k | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 1.79k | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 1.79k | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 1.79k | } | 763 | 48.7M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 48.7M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 48.7M | } |
zstd_lazy.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 50.8M | { | 740 | 50.8M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 50.8M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 50.8M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 195 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 195 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 195 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 195 | } | 749 | 50.8M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 50.8M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 50.8M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 50.8M | assert(matchLength >= MINMATCH); | 757 | 50.8M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 50.8M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 1.12k | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 1.12k | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 1.12k | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 1.12k | } | 763 | 50.8M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 50.8M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 50.8M | } |
zstd_ldm.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 7.30M | { | 740 | 7.30M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 7.30M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 7.30M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 0 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 0 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 0 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 0 | } | 749 | 7.30M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 7.30M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 7.30M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 7.30M | assert(matchLength >= MINMATCH); | 757 | 7.30M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 7.30M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 0 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 0 | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 0 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 0 | } | 763 | 7.30M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 7.30M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 7.30M | } |
zstd_opt.c:ZSTD_storeSeqOnly Line | Count | Source | 739 | 67.2M | { | 740 | 67.2M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 741 | | | 742 | | /* literal Length */ | 743 | 67.2M | assert(litLength <= ZSTD_BLOCKSIZE_MAX); | 744 | 67.2M | if (UNLIKELY(litLength>0xFFFF)) { | 745 | 78 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 746 | 78 | seqStorePtr->longLengthType = ZSTD_llt_literalLength; | 747 | 78 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 748 | 78 | } | 749 | 67.2M | seqStorePtr->sequences[0].litLength = (U16)litLength; | 750 | | | 751 | | /* match offset */ | 752 | 67.2M | seqStorePtr->sequences[0].offBase = offBase; | 753 | | | 754 | | /* match Length */ | 755 | 67.2M | assert(matchLength <= ZSTD_BLOCKSIZE_MAX); | 756 | 67.2M | assert(matchLength >= MINMATCH); | 757 | 67.2M | { size_t const mlBase = matchLength - MINMATCH; | 758 | 67.2M | if (UNLIKELY(mlBase>0xFFFF)) { | 759 | 607 | assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ | 760 | 607 | seqStorePtr->longLengthType = ZSTD_llt_matchLength; | 761 | 607 | seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); | 762 | 607 | } | 763 | 67.2M | seqStorePtr->sequences[0].mlBase = (U16)mlBase; | 764 | 67.2M | } | 765 | | | 766 | 0 | seqStorePtr->sequences++; | 767 | 67.2M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_storeSeqOnly Unexecuted instantiation: fastcover.c:ZSTD_storeSeqOnly Unexecuted instantiation: zdict.c:ZSTD_storeSeqOnly |
768 | | |
769 | | /*! ZSTD_storeSeq() : |
770 | | * Store a sequence (litlen, litPtr, offBase and matchLength) into SeqStore_t. |
771 | | * @offBase : Users should employ macros REPCODE_TO_OFFBASE() and OFFSET_TO_OFFBASE(). |
772 | | * @matchLength : must be >= MINMATCH |
773 | | * Allowed to over-read literals up to litLimit. |
774 | | */ |
775 | | HINT_INLINE UNUSED_ATTR void |
776 | | ZSTD_storeSeq(SeqStore_t* seqStorePtr, |
777 | | size_t litLength, const BYTE* literals, const BYTE* litLimit, |
778 | | U32 offBase, |
779 | | size_t matchLength) |
780 | 242M | { |
781 | 242M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; |
782 | 242M | BYTE const* const litEnd = literals + litLength; |
783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) |
784 | | static const BYTE* g_start = NULL; |
785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ |
786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); |
787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", |
788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); |
789 | | } |
790 | | #endif |
791 | 242M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); |
792 | | /* copy Literals */ |
793 | 242M | assert(seqStorePtr->maxNbLit <= 128 KB); |
794 | 242M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); |
795 | 242M | assert(literals + litLength <= litLimit); |
796 | 242M | if (litEnd <= litLimit_w) { |
797 | | /* Common case we can use wildcopy. |
798 | | * First copy 16 bytes, because literals are likely short. |
799 | | */ |
800 | 234M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); |
801 | 234M | ZSTD_copy16(seqStorePtr->lit, literals); |
802 | 234M | if (litLength > 16) { |
803 | 12.3M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); |
804 | 12.3M | } |
805 | 234M | } else { |
806 | 8.02M | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); |
807 | 8.02M | } |
808 | 242M | seqStorePtr->lit += litLength; |
809 | | |
810 | 242M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); |
811 | 242M | } Unexecuted instantiation: sequence_producer.c:ZSTD_storeSeq zstd_compress.c:ZSTD_storeSeq Line | Count | Source | 780 | 37.2M | { | 781 | 37.2M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 37.2M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 37.2M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 37.2M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 37.2M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 37.2M | assert(literals + litLength <= litLimit); | 796 | 37.2M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 35.3M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 35.3M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 35.3M | if (litLength > 16) { | 803 | 1.61M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 1.61M | } | 805 | 35.3M | } else { | 806 | 1.94M | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 1.94M | } | 808 | 37.2M | seqStorePtr->lit += litLength; | 809 | | | 810 | 37.2M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 37.2M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_storeSeq Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_storeSeq Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_storeSeq zstd_double_fast.c:ZSTD_storeSeq Line | Count | Source | 780 | 31.3M | { | 781 | 31.3M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 31.3M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 31.3M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 31.3M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 31.3M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 31.3M | assert(literals + litLength <= litLimit); | 796 | 31.3M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 29.7M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 29.7M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 29.7M | if (litLength > 16) { | 803 | 1.91M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 1.91M | } | 805 | 29.7M | } else { | 806 | 1.58M | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 1.58M | } | 808 | 31.3M | seqStorePtr->lit += litLength; | 809 | | | 810 | 31.3M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 31.3M | } |
zstd_fast.c:ZSTD_storeSeq Line | Count | Source | 780 | 48.7M | { | 781 | 48.7M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 48.7M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 48.7M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 48.7M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 48.7M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 48.7M | assert(literals + litLength <= litLimit); | 796 | 48.7M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 46.9M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 46.9M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 46.9M | if (litLength > 16) { | 803 | 2.89M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 2.89M | } | 805 | 46.9M | } else { | 806 | 1.77M | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 1.77M | } | 808 | 48.7M | seqStorePtr->lit += litLength; | 809 | | | 810 | 48.7M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 48.7M | } |
zstd_lazy.c:ZSTD_storeSeq Line | Count | Source | 780 | 50.8M | { | 781 | 50.8M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 50.8M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 50.8M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 50.8M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 50.8M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 50.8M | assert(literals + litLength <= litLimit); | 796 | 50.8M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 49.0M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 49.0M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 49.0M | if (litLength > 16) { | 803 | 3.15M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 3.15M | } | 805 | 49.0M | } else { | 806 | 1.85M | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 1.85M | } | 808 | 50.8M | seqStorePtr->lit += litLength; | 809 | | | 810 | 50.8M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 50.8M | } |
Line | Count | Source | 780 | 7.30M | { | 781 | 7.30M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 7.30M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 7.30M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 7.30M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 7.30M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 7.30M | assert(literals + litLength <= litLimit); | 796 | 7.30M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 7.18M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 7.18M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 7.18M | if (litLength > 16) { | 803 | 453k | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 453k | } | 805 | 7.18M | } else { | 806 | 118k | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 118k | } | 808 | 7.30M | seqStorePtr->lit += litLength; | 809 | | | 810 | 7.30M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 7.30M | } |
Line | Count | Source | 780 | 67.2M | { | 781 | 67.2M | BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; | 782 | 67.2M | BYTE const* const litEnd = literals + litLength; | 783 | | #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) | 784 | | static const BYTE* g_start = NULL; | 785 | | if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ | 786 | | { U32 const pos = (U32)((const BYTE*)literals - g_start); | 787 | | DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", | 788 | | pos, (U32)litLength, (U32)matchLength, (U32)offBase); | 789 | | } | 790 | | #endif | 791 | 67.2M | assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); | 792 | | /* copy Literals */ | 793 | 67.2M | assert(seqStorePtr->maxNbLit <= 128 KB); | 794 | 67.2M | assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); | 795 | 67.2M | assert(literals + litLength <= litLimit); | 796 | 67.2M | if (litEnd <= litLimit_w) { | 797 | | /* Common case we can use wildcopy. | 798 | | * First copy 16 bytes, because literals are likely short. | 799 | | */ | 800 | 66.5M | ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); | 801 | 66.5M | ZSTD_copy16(seqStorePtr->lit, literals); | 802 | 66.5M | if (litLength > 16) { | 803 | 2.30M | ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, litLength-16, ZSTD_no_overlap); | 804 | 2.30M | } | 805 | 66.5M | } else { | 806 | 748k | ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); | 807 | 748k | } | 808 | 67.2M | seqStorePtr->lit += litLength; | 809 | | | 810 | 67.2M | ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength); | 811 | 67.2M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_storeSeq Unexecuted instantiation: fastcover.c:ZSTD_storeSeq Unexecuted instantiation: zdict.c:ZSTD_storeSeq |
812 | | |
813 | | /* ZSTD_updateRep() : |
814 | | * updates in-place @rep (array of repeat offsets) |
815 | | * @offBase : sum-type, using numeric representation of ZSTD_storeSeq() |
816 | | */ |
817 | | MEM_STATIC void |
818 | | ZSTD_updateRep(U32 rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0) |
819 | 454M | { |
820 | 454M | if (OFFBASE_IS_OFFSET(offBase)) { /* full offset */ |
821 | 235M | rep[2] = rep[1]; |
822 | 235M | rep[1] = rep[0]; |
823 | 235M | rep[0] = OFFBASE_TO_OFFSET(offBase); |
824 | 235M | } else { /* repcode */ |
825 | 219M | U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; |
826 | 219M | if (repCode > 0) { /* note : if repCode==0, no change */ |
827 | 105M | U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; |
828 | 105M | rep[2] = (repCode >= 2) ? rep[1] : rep[2]; |
829 | 105M | rep[1] = rep[0]; |
830 | 105M | rep[0] = currentOffset; |
831 | 113M | } else { /* repCode == 0 */ |
832 | | /* nothing to do */ |
833 | 113M | } |
834 | 219M | } |
835 | 454M | } Unexecuted instantiation: sequence_producer.c:ZSTD_updateRep zstd_compress.c:ZSTD_updateRep Line | Count | Source | 819 | 78.0M | { | 820 | 78.0M | if (OFFBASE_IS_OFFSET(offBase)) { /* full offset */ | 821 | 35.1M | rep[2] = rep[1]; | 822 | 35.1M | rep[1] = rep[0]; | 823 | 35.1M | rep[0] = OFFBASE_TO_OFFSET(offBase); | 824 | 42.8M | } else { /* repcode */ | 825 | 42.8M | U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; | 826 | 42.8M | if (repCode > 0) { /* note : if repCode==0, no change */ | 827 | 24.0M | U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; | 828 | 24.0M | rep[2] = (repCode >= 2) ? rep[1] : rep[2]; | 829 | 24.0M | rep[1] = rep[0]; | 830 | 24.0M | rep[0] = currentOffset; | 831 | 24.0M | } else { /* repCode == 0 */ | 832 | | /* nothing to do */ | 833 | 18.7M | } | 834 | 42.8M | } | 835 | 78.0M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_updateRep Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_updateRep zstd_compress_superblock.c:ZSTD_updateRep Line | Count | Source | 819 | 45.2k | { | 820 | 45.2k | if (OFFBASE_IS_OFFSET(offBase)) { /* full offset */ | 821 | 29.4k | rep[2] = rep[1]; | 822 | 29.4k | rep[1] = rep[0]; | 823 | 29.4k | rep[0] = OFFBASE_TO_OFFSET(offBase); | 824 | 29.4k | } else { /* repcode */ | 825 | 15.7k | U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; | 826 | 15.7k | if (repCode > 0) { /* note : if repCode==0, no change */ | 827 | 7.30k | U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; | 828 | 7.30k | rep[2] = (repCode >= 2) ? rep[1] : rep[2]; | 829 | 7.30k | rep[1] = rep[0]; | 830 | 7.30k | rep[0] = currentOffset; | 831 | 8.48k | } else { /* repCode == 0 */ | 832 | | /* nothing to do */ | 833 | 8.48k | } | 834 | 15.7k | } | 835 | 45.2k | } |
Unexecuted instantiation: zstd_double_fast.c:ZSTD_updateRep Unexecuted instantiation: zstd_fast.c:ZSTD_updateRep Unexecuted instantiation: zstd_lazy.c:ZSTD_updateRep Unexecuted instantiation: zstd_ldm.c:ZSTD_updateRep zstd_opt.c:ZSTD_updateRep Line | Count | Source | 819 | 376M | { | 820 | 376M | if (OFFBASE_IS_OFFSET(offBase)) { /* full offset */ | 821 | 200M | rep[2] = rep[1]; | 822 | 200M | rep[1] = rep[0]; | 823 | 200M | rep[0] = OFFBASE_TO_OFFSET(offBase); | 824 | 200M | } else { /* repcode */ | 825 | 176M | U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; | 826 | 176M | if (repCode > 0) { /* note : if repCode==0, no change */ | 827 | 81.7M | U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; | 828 | 81.7M | rep[2] = (repCode >= 2) ? rep[1] : rep[2]; | 829 | 81.7M | rep[1] = rep[0]; | 830 | 81.7M | rep[0] = currentOffset; | 831 | 94.8M | } else { /* repCode == 0 */ | 832 | | /* nothing to do */ | 833 | 94.8M | } | 834 | 176M | } | 835 | 376M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_updateRep Unexecuted instantiation: fastcover.c:ZSTD_updateRep Unexecuted instantiation: zdict.c:ZSTD_updateRep |
836 | | |
837 | | typedef struct repcodes_s { |
838 | | U32 rep[3]; |
839 | | } Repcodes_t; |
840 | | |
841 | | MEM_STATIC Repcodes_t |
842 | | ZSTD_newRep(U32 const rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0) |
843 | 376M | { |
844 | 376M | Repcodes_t newReps; |
845 | 376M | ZSTD_memcpy(&newReps, rep, sizeof(newReps)); |
846 | 376M | ZSTD_updateRep(newReps.rep, offBase, ll0); |
847 | 376M | return newReps; |
848 | 376M | } Unexecuted instantiation: sequence_producer.c:ZSTD_newRep Unexecuted instantiation: zstd_compress.c:ZSTD_newRep Unexecuted instantiation: zstd_compress_literals.c:ZSTD_newRep Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_newRep Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_newRep Unexecuted instantiation: zstd_double_fast.c:ZSTD_newRep Unexecuted instantiation: zstd_fast.c:ZSTD_newRep Unexecuted instantiation: zstd_lazy.c:ZSTD_newRep Unexecuted instantiation: zstd_ldm.c:ZSTD_newRep Line | Count | Source | 843 | 376M | { | 844 | 376M | Repcodes_t newReps; | 845 | 376M | ZSTD_memcpy(&newReps, rep, sizeof(newReps)); | 846 | 376M | ZSTD_updateRep(newReps.rep, offBase, ll0); | 847 | 376M | return newReps; | 848 | 376M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_newRep Unexecuted instantiation: fastcover.c:ZSTD_newRep Unexecuted instantiation: zdict.c:ZSTD_newRep |
849 | | |
850 | | |
851 | | /*-************************************* |
852 | | * Match length counter |
853 | | ***************************************/ |
854 | | MEM_STATIC size_t ZSTD_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* const pInLimit) |
855 | 4.33G | { |
856 | 4.33G | const BYTE* const pStart = pIn; |
857 | 4.33G | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); |
858 | | |
859 | 4.33G | if (pIn < pInLoopLimit) { |
860 | 4.33G | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); |
861 | 4.33G | if (diff) return ZSTD_NbCommonBytes(diff); } |
862 | 787M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); |
863 | 6.60G | while (pIn < pInLoopLimit) { |
864 | 6.60G | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); |
865 | 6.60G | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } |
866 | 782M | pIn += ZSTD_NbCommonBytes(diff); |
867 | 782M | return (size_t)(pIn - pStart); |
868 | 6.60G | } } |
869 | 10.9M | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } |
870 | 8.02M | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } |
871 | 8.02M | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; |
872 | 8.02M | return (size_t)(pIn - pStart); |
873 | 4.33G | } sequence_producer.c:ZSTD_count Line | Count | Source | 855 | 26.4M | { | 856 | 26.4M | const BYTE* const pStart = pIn; | 857 | 26.4M | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 26.4M | if (pIn < pInLoopLimit) { | 860 | 26.3M | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 26.3M | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 1.18M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 5.82M | while (pIn < pInLoopLimit) { | 864 | 5.78M | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 5.78M | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 1.15M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 1.15M | return (size_t)(pIn - pStart); | 868 | 5.78M | } } | 869 | 93.9k | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 93.9k | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 93.9k | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 93.9k | return (size_t)(pIn - pStart); | 873 | 26.4M | } |
zstd_compress.c:ZSTD_count Line | Count | Source | 855 | 198k | { | 856 | 198k | const BYTE* const pStart = pIn; | 857 | 198k | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 198k | if (pIn < pInLoopLimit) { | 860 | 105k | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 105k | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 43.3k | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 80.4k | while (pIn < pInLoopLimit) { | 864 | 41.6k | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 41.6k | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 4.52k | pIn += ZSTD_NbCommonBytes(diff); | 867 | 4.52k | return (size_t)(pIn - pStart); | 868 | 41.6k | } } | 869 | 131k | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 131k | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 131k | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 131k | return (size_t)(pIn - pStart); | 873 | 198k | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_count Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_count Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_count zstd_double_fast.c:ZSTD_count Line | Count | Source | 855 | 32.3M | { | 856 | 32.3M | const BYTE* const pStart = pIn; | 857 | 32.3M | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 32.3M | if (pIn < pInLoopLimit) { | 860 | 31.8M | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 31.8M | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 8.00M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 121M | while (pIn < pInLoopLimit) { | 864 | 121M | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 121M | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 7.55M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 7.55M | return (size_t)(pIn - pStart); | 868 | 121M | } } | 869 | 995k | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 977k | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 977k | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 977k | return (size_t)(pIn - pStart); | 873 | 32.3M | } |
Line | Count | Source | 855 | 49.3M | { | 856 | 49.3M | const BYTE* const pStart = pIn; | 857 | 49.3M | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 49.3M | if (pIn < pInLoopLimit) { | 860 | 48.7M | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 48.7M | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 19.0M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 228M | while (pIn < pInLoopLimit) { | 864 | 227M | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 227M | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 17.7M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 17.7M | return (size_t)(pIn - pStart); | 868 | 227M | } } | 869 | 1.81M | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 1.81M | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 1.81M | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 1.81M | return (size_t)(pIn - pStart); | 873 | 49.3M | } |
Line | Count | Source | 855 | 507M | { | 856 | 507M | const BYTE* const pStart = pIn; | 857 | 507M | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 507M | if (pIn < pInLoopLimit) { | 860 | 506M | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 506M | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 133M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 2.11G | while (pIn < pInLoopLimit) { | 864 | 2.11G | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 2.11G | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 130M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 130M | return (size_t)(pIn - pStart); | 868 | 2.11G | } } | 869 | 4.13M | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 3.55M | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 3.55M | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 3.55M | return (size_t)(pIn - pStart); | 873 | 507M | } |
Line | Count | Source | 855 | 39.7M | { | 856 | 39.7M | const BYTE* const pStart = pIn; | 857 | 39.7M | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 39.7M | if (pIn < pInLoopLimit) { | 860 | 39.7M | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 39.7M | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 9.85M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 40.5M | while (pIn < pInLoopLimit) { | 864 | 40.2M | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 40.2M | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 9.63M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 9.63M | return (size_t)(pIn - pStart); | 868 | 40.2M | } } | 869 | 231k | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 231k | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 231k | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 231k | return (size_t)(pIn - pStart); | 873 | 39.7M | } |
Line | Count | Source | 855 | 3.68G | { | 856 | 3.68G | const BYTE* const pStart = pIn; | 857 | 3.68G | const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); | 858 | | | 859 | 3.68G | if (pIn < pInLoopLimit) { | 860 | 3.68G | { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 861 | 3.68G | if (diff) return ZSTD_NbCommonBytes(diff); } | 862 | 615M | pIn+=sizeof(size_t); pMatch+=sizeof(size_t); | 863 | 4.09G | while (pIn < pInLoopLimit) { | 864 | 4.09G | size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); | 865 | 4.09G | if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } | 866 | 615M | pIn += ZSTD_NbCommonBytes(diff); | 867 | 615M | return (size_t)(pIn - pStart); | 868 | 4.09G | } } | 869 | 3.52M | if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } | 870 | 2.60M | if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } | 871 | 2.80M | if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; | 872 | 1.21M | return (size_t)(pIn - pStart); | 873 | 3.68G | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_count Unexecuted instantiation: fastcover.c:ZSTD_count Unexecuted instantiation: zdict.c:ZSTD_count |
874 | | |
875 | | /** ZSTD_count_2segments() : |
876 | | * can count match length with `ip` & `match` in 2 different segments. |
877 | | * convention : on reaching mEnd, match count continue starting from iStart |
878 | | */ |
879 | | MEM_STATIC size_t |
880 | | ZSTD_count_2segments(const BYTE* ip, const BYTE* match, |
881 | | const BYTE* iEnd, const BYTE* mEnd, const BYTE* iStart) |
882 | 118M | { |
883 | 118M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); |
884 | 118M | size_t const matchLength = ZSTD_count(ip, match, vEnd); |
885 | 118M | if (match + matchLength != mEnd) return matchLength; |
886 | 1.19M | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); |
887 | 1.19M | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); |
888 | 1.19M | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); |
889 | 1.19M | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); |
890 | 1.19M | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); |
891 | 1.19M | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); |
892 | 118M | } Unexecuted instantiation: sequence_producer.c:ZSTD_count_2segments Unexecuted instantiation: zstd_compress.c:ZSTD_count_2segments Unexecuted instantiation: zstd_compress_literals.c:ZSTD_count_2segments Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_count_2segments Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_count_2segments zstd_double_fast.c:ZSTD_count_2segments Line | Count | Source | 882 | 3.26M | { | 883 | 3.26M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); | 884 | 3.26M | size_t const matchLength = ZSTD_count(ip, match, vEnd); | 885 | 3.26M | if (match + matchLength != mEnd) return matchLength; | 886 | 17.9k | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); | 887 | 17.9k | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); | 888 | 17.9k | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); | 889 | 17.9k | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); | 890 | 17.9k | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); | 891 | 17.9k | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); | 892 | 3.26M | } |
zstd_fast.c:ZSTD_count_2segments Line | Count | Source | 882 | 16.8M | { | 883 | 16.8M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); | 884 | 16.8M | size_t const matchLength = ZSTD_count(ip, match, vEnd); | 885 | 16.8M | if (match + matchLength != mEnd) return matchLength; | 886 | 565k | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); | 887 | 565k | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); | 888 | 565k | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); | 889 | 565k | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); | 890 | 565k | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); | 891 | 565k | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); | 892 | 16.8M | } |
zstd_lazy.c:ZSTD_count_2segments Line | Count | Source | 882 | 28.1M | { | 883 | 28.1M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); | 884 | 28.1M | size_t const matchLength = ZSTD_count(ip, match, vEnd); | 885 | 28.1M | if (match + matchLength != mEnd) return matchLength; | 886 | 218k | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); | 887 | 218k | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); | 888 | 218k | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); | 889 | 218k | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); | 890 | 218k | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); | 891 | 218k | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); | 892 | 28.1M | } |
zstd_ldm.c:ZSTD_count_2segments Line | Count | Source | 882 | 1.44M | { | 883 | 1.44M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); | 884 | 1.44M | size_t const matchLength = ZSTD_count(ip, match, vEnd); | 885 | 1.44M | if (match + matchLength != mEnd) return matchLength; | 886 | 11.8k | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); | 887 | 11.8k | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); | 888 | 11.8k | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); | 889 | 11.8k | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); | 890 | 11.8k | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); | 891 | 11.8k | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); | 892 | 1.44M | } |
zstd_opt.c:ZSTD_count_2segments Line | Count | Source | 882 | 68.8M | { | 883 | 68.8M | const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd); | 884 | 68.8M | size_t const matchLength = ZSTD_count(ip, match, vEnd); | 885 | 68.8M | if (match + matchLength != mEnd) return matchLength; | 886 | 382k | DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength); | 887 | 382k | DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match)); | 888 | 382k | DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip)); | 889 | 382k | DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart); | 890 | 382k | DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd)); | 891 | 382k | return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd); | 892 | 68.8M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_count_2segments Unexecuted instantiation: fastcover.c:ZSTD_count_2segments Unexecuted instantiation: zdict.c:ZSTD_count_2segments |
893 | | |
894 | | |
895 | | /*-************************************* |
896 | | * Hashes |
897 | | ***************************************/ |
898 | | static const U32 prime3bytes = 506832829U; |
899 | 1.05G | static U32 ZSTD_hash3(U32 u, U32 h, U32 s) { assert(h <= 32); return (((u << (32-24)) * prime3bytes) ^ s) >> (32-h) ; } Unexecuted instantiation: sequence_producer.c:ZSTD_hash3 Unexecuted instantiation: zstd_compress.c:ZSTD_hash3 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash3 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash3 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash3 Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash3 Unexecuted instantiation: zstd_fast.c:ZSTD_hash3 Unexecuted instantiation: zstd_lazy.c:ZSTD_hash3 Unexecuted instantiation: zstd_ldm.c:ZSTD_hash3 Line | Count | Source | 899 | 1.05G | static U32 ZSTD_hash3(U32 u, U32 h, U32 s) { assert(h <= 32); return (((u << (32-24)) * prime3bytes) ^ s) >> (32-h) ; } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash3 Unexecuted instantiation: fastcover.c:ZSTD_hash3 Unexecuted instantiation: zdict.c:ZSTD_hash3 |
900 | 1.05G | MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h, 0); } /* only in zstd_opt.h */ Unexecuted instantiation: sequence_producer.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_compress.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_fast.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_lazy.c:ZSTD_hash3Ptr Unexecuted instantiation: zstd_ldm.c:ZSTD_hash3Ptr Line | Count | Source | 900 | 1.05G | MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h, 0); } /* only in zstd_opt.h */ |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash3Ptr Unexecuted instantiation: fastcover.c:ZSTD_hash3Ptr Unexecuted instantiation: zdict.c:ZSTD_hash3Ptr |
901 | 0 | MEM_STATIC size_t ZSTD_hash3PtrS(const void* ptr, U32 h, U32 s) { return ZSTD_hash3(MEM_readLE32(ptr), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_lazy.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_ldm.c:ZSTD_hash3PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash3PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash3PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash3PtrS Unexecuted instantiation: zdict.c:ZSTD_hash3PtrS |
902 | | |
903 | | static const U32 prime4bytes = 2654435761U; |
904 | 1.91G | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } sequence_producer.c:ZSTD_hash4 Line | Count | Source | 904 | 52.0M | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } |
Unexecuted instantiation: zstd_compress.c:ZSTD_hash4 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash4 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash4 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash4 zstd_double_fast.c:ZSTD_hash4 Line | Count | Source | 904 | 237M | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } |
Line | Count | Source | 904 | 103M | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } |
Line | Count | Source | 904 | 845M | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash4 Line | Count | Source | 904 | 675M | static U32 ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash4 Unexecuted instantiation: fastcover.c:ZSTD_hash4 Unexecuted instantiation: zdict.c:ZSTD_hash4 |
905 | 1.47G | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } sequence_producer.c:ZSTD_hash4Ptr Line | Count | Source | 905 | 52.0M | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } |
Unexecuted instantiation: zstd_compress.c:ZSTD_hash4Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash4Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash4Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash4Ptr zstd_double_fast.c:ZSTD_hash4Ptr Line | Count | Source | 905 | 237M | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } |
zstd_fast.c:ZSTD_hash4Ptr Line | Count | Source | 905 | 103M | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } |
zstd_lazy.c:ZSTD_hash4Ptr Line | Count | Source | 905 | 405M | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash4Ptr Line | Count | Source | 905 | 675M | static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash4Ptr Unexecuted instantiation: fastcover.c:ZSTD_hash4Ptr Unexecuted instantiation: zdict.c:ZSTD_hash4Ptr |
906 | 439M | static size_t ZSTD_hash4PtrS(const void* ptr, U32 h, U32 s) { return ZSTD_hash4(MEM_readLE32(ptr), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash4PtrS zstd_lazy.c:ZSTD_hash4PtrS Line | Count | Source | 906 | 439M | static size_t ZSTD_hash4PtrS(const void* ptr, U32 h, U32 s) { return ZSTD_hash4(MEM_readLE32(ptr), h, s); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash4PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash4PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash4PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash4PtrS Unexecuted instantiation: zdict.c:ZSTD_hash4PtrS |
907 | | |
908 | | static const U64 prime5bytes = 889523592379ULL; |
909 | 1.84G | static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; } Unexecuted instantiation: sequence_producer.c:ZSTD_hash5 Unexecuted instantiation: zstd_compress.c:ZSTD_hash5 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash5 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash5 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash5 zstd_double_fast.c:ZSTD_hash5 Line | Count | Source | 909 | 667M | static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 909 | 195M | static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 909 | 825M | static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash5 Line | Count | Source | 909 | 161M | static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash5 Unexecuted instantiation: fastcover.c:ZSTD_hash5 Unexecuted instantiation: zdict.c:ZSTD_hash5 |
910 | 1.28G | static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash5Ptr Unexecuted instantiation: zstd_compress.c:ZSTD_hash5Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash5Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash5Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash5Ptr zstd_double_fast.c:ZSTD_hash5Ptr Line | Count | Source | 910 | 667M | static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); } |
zstd_fast.c:ZSTD_hash5Ptr Line | Count | Source | 910 | 195M | static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); } |
zstd_lazy.c:ZSTD_hash5Ptr Line | Count | Source | 910 | 264M | static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash5Ptr Line | Count | Source | 910 | 161M | static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash5Ptr Unexecuted instantiation: fastcover.c:ZSTD_hash5Ptr Unexecuted instantiation: zdict.c:ZSTD_hash5Ptr |
911 | 560M | static size_t ZSTD_hash5PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash5(MEM_readLE64(p), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash5PtrS zstd_lazy.c:ZSTD_hash5PtrS Line | Count | Source | 911 | 560M | static size_t ZSTD_hash5PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash5(MEM_readLE64(p), h, s); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash5PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash5PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash5PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash5PtrS Unexecuted instantiation: zdict.c:ZSTD_hash5PtrS |
912 | | |
913 | | static const U64 prime6bytes = 227718039650203ULL; |
914 | 1.17G | static size_t ZSTD_hash6(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-48)) * prime6bytes) ^ s) >> (64-h)) ; } Unexecuted instantiation: sequence_producer.c:ZSTD_hash6 Unexecuted instantiation: zstd_compress.c:ZSTD_hash6 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash6 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash6 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash6 zstd_double_fast.c:ZSTD_hash6 Line | Count | Source | 914 | 121M | static size_t ZSTD_hash6(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-48)) * prime6bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 914 | 326M | static size_t ZSTD_hash6(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-48)) * prime6bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 914 | 547M | static size_t ZSTD_hash6(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-48)) * prime6bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash6 Line | Count | Source | 914 | 180M | static size_t ZSTD_hash6(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-48)) * prime6bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash6 Unexecuted instantiation: fastcover.c:ZSTD_hash6 Unexecuted instantiation: zdict.c:ZSTD_hash6 |
915 | 879M | static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h, 0); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash6Ptr Unexecuted instantiation: zstd_compress.c:ZSTD_hash6Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash6Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash6Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash6Ptr zstd_double_fast.c:ZSTD_hash6Ptr Line | Count | Source | 915 | 121M | static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h, 0); } |
zstd_fast.c:ZSTD_hash6Ptr Line | Count | Source | 915 | 326M | static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h, 0); } |
zstd_lazy.c:ZSTD_hash6Ptr Line | Count | Source | 915 | 249M | static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash6Ptr Line | Count | Source | 915 | 181M | static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash6Ptr Unexecuted instantiation: fastcover.c:ZSTD_hash6Ptr Unexecuted instantiation: zdict.c:ZSTD_hash6Ptr |
916 | 297M | static size_t ZSTD_hash6PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash6(MEM_readLE64(p), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash6PtrS zstd_lazy.c:ZSTD_hash6PtrS Line | Count | Source | 916 | 297M | static size_t ZSTD_hash6PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash6(MEM_readLE64(p), h, s); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash6PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash6PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash6PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash6PtrS Unexecuted instantiation: zdict.c:ZSTD_hash6PtrS |
917 | | |
918 | | static const U64 prime7bytes = 58295818150454627ULL; |
919 | 339M | static size_t ZSTD_hash7(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-56)) * prime7bytes) ^ s) >> (64-h)) ; } Unexecuted instantiation: sequence_producer.c:ZSTD_hash7 Unexecuted instantiation: zstd_compress.c:ZSTD_hash7 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash7 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash7 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash7 zstd_double_fast.c:ZSTD_hash7 Line | Count | Source | 919 | 155M | static size_t ZSTD_hash7(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-56)) * prime7bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 919 | 173M | static size_t ZSTD_hash7(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-56)) * prime7bytes) ^ s) >> (64-h)) ; } |
Line | Count | Source | 919 | 6.35M | static size_t ZSTD_hash7(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-56)) * prime7bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash7 Line | Count | Source | 919 | 3.95M | static size_t ZSTD_hash7(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u << (64-56)) * prime7bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash7 Unexecuted instantiation: fastcover.c:ZSTD_hash7 Unexecuted instantiation: zdict.c:ZSTD_hash7 |
920 | 339M | static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h, 0); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash7Ptr Unexecuted instantiation: zstd_compress.c:ZSTD_hash7Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash7Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash7Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash7Ptr zstd_double_fast.c:ZSTD_hash7Ptr Line | Count | Source | 920 | 155M | static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h, 0); } |
zstd_fast.c:ZSTD_hash7Ptr Line | Count | Source | 920 | 173M | static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h, 0); } |
zstd_lazy.c:ZSTD_hash7Ptr Line | Count | Source | 920 | 6.35M | static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hash7Ptr Line | Count | Source | 920 | 3.95M | static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash7Ptr Unexecuted instantiation: fastcover.c:ZSTD_hash7Ptr Unexecuted instantiation: zdict.c:ZSTD_hash7Ptr |
921 | 0 | static size_t ZSTD_hash7PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash7(MEM_readLE64(p), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_lazy.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_ldm.c:ZSTD_hash7PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash7PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash7PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash7PtrS Unexecuted instantiation: zdict.c:ZSTD_hash7PtrS |
922 | | |
923 | | static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL; |
924 | 4.46G | static size_t ZSTD_hash8(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u) * prime8bytes) ^ s) >> (64-h)) ; } Unexecuted instantiation: sequence_producer.c:ZSTD_hash8 Unexecuted instantiation: zstd_compress.c:ZSTD_hash8 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash8 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash8 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash8 zstd_double_fast.c:ZSTD_hash8 Line | Count | Source | 924 | 1.19G | static size_t ZSTD_hash8(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u) * prime8bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zstd_fast.c:ZSTD_hash8 Unexecuted instantiation: zstd_lazy.c:ZSTD_hash8 Unexecuted instantiation: zstd_ldm.c:ZSTD_hash8 Unexecuted instantiation: zstd_opt.c:ZSTD_hash8 Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash8 Line | Count | Source | 924 | 3.26G | static size_t ZSTD_hash8(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u) * prime8bytes) ^ s) >> (64-h)) ; } |
Unexecuted instantiation: zdict.c:ZSTD_hash8 |
925 | 4.46G | static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h, 0); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_compress.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash8Ptr zstd_double_fast.c:ZSTD_hash8Ptr Line | Count | Source | 925 | 1.19G | static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zstd_fast.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_lazy.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_ldm.c:ZSTD_hash8Ptr Unexecuted instantiation: zstd_opt.c:ZSTD_hash8Ptr Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash8Ptr fastcover.c:ZSTD_hash8Ptr Line | Count | Source | 925 | 3.26G | static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h, 0); } |
Unexecuted instantiation: zdict.c:ZSTD_hash8Ptr |
926 | 0 | static size_t ZSTD_hash8PtrS(const void* p, U32 h, U64 s) { return ZSTD_hash8(MEM_readLE64(p), h, s); } Unexecuted instantiation: sequence_producer.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_compress.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_double_fast.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_fast.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_lazy.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_ldm.c:ZSTD_hash8PtrS Unexecuted instantiation: zstd_opt.c:ZSTD_hash8PtrS Unexecuted instantiation: zstdmt_compress.c:ZSTD_hash8PtrS Unexecuted instantiation: fastcover.c:ZSTD_hash8PtrS Unexecuted instantiation: zdict.c:ZSTD_hash8PtrS |
927 | | |
928 | | |
929 | | MEM_STATIC FORCE_INLINE_ATTR |
930 | | size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls) |
931 | 5.17G | { |
932 | | /* Although some of these hashes do support hBits up to 64, some do not. |
933 | | * To be on the safe side, always avoid hBits > 32. */ |
934 | 5.17G | assert(hBits <= 32); |
935 | | |
936 | 5.17G | switch(mls) |
937 | 5.17G | { |
938 | 626M | default: |
939 | 1.47G | case 4: return ZSTD_hash4Ptr(p, hBits); |
940 | 1.28G | case 5: return ZSTD_hash5Ptr(p, hBits); |
941 | 879M | case 6: return ZSTD_hash6Ptr(p, hBits); |
942 | 339M | case 7: return ZSTD_hash7Ptr(p, hBits); |
943 | 1.19G | case 8: return ZSTD_hash8Ptr(p, hBits); |
944 | 5.17G | } |
945 | 5.17G | } sequence_producer.c:ZSTD_hashPtr Line | Count | Source | 931 | 52.0M | { | 932 | | /* Although some of these hashes do support hBits up to 64, some do not. | 933 | | * To be on the safe side, always avoid hBits > 32. */ | 934 | 52.0M | assert(hBits <= 32); | 935 | | | 936 | 52.0M | switch(mls) | 937 | 52.0M | { | 938 | 0 | default: | 939 | 52.0M | case 4: return ZSTD_hash4Ptr(p, hBits); | 940 | 0 | case 5: return ZSTD_hash5Ptr(p, hBits); | 941 | 0 | case 6: return ZSTD_hash6Ptr(p, hBits); | 942 | 0 | case 7: return ZSTD_hash7Ptr(p, hBits); | 943 | 0 | case 8: return ZSTD_hash8Ptr(p, hBits); | 944 | 52.0M | } | 945 | 52.0M | } |
Unexecuted instantiation: zstd_compress.c:ZSTD_hashPtr Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hashPtr Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hashPtr Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hashPtr zstd_double_fast.c:ZSTD_hashPtr Line | Count | Source | 931 | 2.38G | { | 932 | | /* Although some of these hashes do support hBits up to 64, some do not. | 933 | | * To be on the safe side, always avoid hBits > 32. */ | 934 | 2.38G | assert(hBits <= 32); | 935 | | | 936 | 2.38G | switch(mls) | 937 | 2.38G | { | 938 | 51.0M | default: | 939 | 237M | case 4: return ZSTD_hash4Ptr(p, hBits); | 940 | 667M | case 5: return ZSTD_hash5Ptr(p, hBits); | 941 | 121M | case 6: return ZSTD_hash6Ptr(p, hBits); | 942 | 155M | case 7: return ZSTD_hash7Ptr(p, hBits); | 943 | 1.19G | case 8: return ZSTD_hash8Ptr(p, hBits); | 944 | 2.38G | } | 945 | 2.38G | } |
Line | Count | Source | 931 | 797M | { | 932 | | /* Although some of these hashes do support hBits up to 64, some do not. | 933 | | * To be on the safe side, always avoid hBits > 32. */ | 934 | 797M | assert(hBits <= 32); | 935 | | | 936 | 797M | switch(mls) | 937 | 797M | { | 938 | 54.1M | default: | 939 | 103M | case 4: return ZSTD_hash4Ptr(p, hBits); | 940 | 195M | case 5: return ZSTD_hash5Ptr(p, hBits); | 941 | 326M | case 6: return ZSTD_hash6Ptr(p, hBits); | 942 | 173M | case 7: return ZSTD_hash7Ptr(p, hBits); | 943 | 0 | case 8: return ZSTD_hash8Ptr(p, hBits); | 944 | 797M | } | 945 | 797M | } |
Line | Count | Source | 931 | 926M | { | 932 | | /* Although some of these hashes do support hBits up to 64, some do not. | 933 | | * To be on the safe side, always avoid hBits > 32. */ | 934 | 926M | assert(hBits <= 32); | 935 | | | 936 | 926M | switch(mls) | 937 | 926M | { | 938 | 8.90M | default: | 939 | 405M | case 4: return ZSTD_hash4Ptr(p, hBits); | 940 | 264M | case 5: return ZSTD_hash5Ptr(p, hBits); | 941 | 249M | case 6: return ZSTD_hash6Ptr(p, hBits); | 942 | 6.35M | case 7: return ZSTD_hash7Ptr(p, hBits); | 943 | 0 | case 8: return ZSTD_hash8Ptr(p, hBits); | 944 | 926M | } | 945 | 926M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hashPtr Line | Count | Source | 931 | 1.02G | { | 932 | | /* Although some of these hashes do support hBits up to 64, some do not. | 933 | | * To be on the safe side, always avoid hBits > 32. */ | 934 | 1.02G | assert(hBits <= 32); | 935 | | | 936 | 1.02G | switch(mls) | 937 | 1.02G | { | 938 | 512M | default: | 939 | 675M | case 4: return ZSTD_hash4Ptr(p, hBits); | 940 | 161M | case 5: return ZSTD_hash5Ptr(p, hBits); | 941 | 181M | case 6: return ZSTD_hash6Ptr(p, hBits); | 942 | 3.95M | case 7: return ZSTD_hash7Ptr(p, hBits); | 943 | 0 | case 8: return ZSTD_hash8Ptr(p, hBits); | 944 | 1.02G | } | 945 | 1.02G | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_hashPtr Unexecuted instantiation: fastcover.c:ZSTD_hashPtr Unexecuted instantiation: zdict.c:ZSTD_hashPtr |
946 | | |
947 | | MEM_STATIC FORCE_INLINE_ATTR |
948 | 1.29G | size_t ZSTD_hashPtrSalted(const void* p, U32 hBits, U32 mls, const U64 hashSalt) { |
949 | | /* Although some of these hashes do support hBits up to 64, some do not. |
950 | | * To be on the safe side, always avoid hBits > 32. */ |
951 | 1.29G | assert(hBits <= 32); |
952 | | |
953 | 1.29G | switch(mls) |
954 | 1.29G | { |
955 | 10.8M | default: |
956 | 439M | case 4: return ZSTD_hash4PtrS(p, hBits, (U32)hashSalt); |
957 | 560M | case 5: return ZSTD_hash5PtrS(p, hBits, hashSalt); |
958 | 297M | case 6: return ZSTD_hash6PtrS(p, hBits, hashSalt); |
959 | 0 | case 7: return ZSTD_hash7PtrS(p, hBits, hashSalt); |
960 | 0 | case 8: return ZSTD_hash8PtrS(p, hBits, hashSalt); |
961 | 1.29G | } |
962 | 1.29G | } Unexecuted instantiation: sequence_producer.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_compress.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_double_fast.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_fast.c:ZSTD_hashPtrSalted zstd_lazy.c:ZSTD_hashPtrSalted Line | Count | Source | 948 | 1.29G | size_t ZSTD_hashPtrSalted(const void* p, U32 hBits, U32 mls, const U64 hashSalt) { | 949 | | /* Although some of these hashes do support hBits up to 64, some do not. | 950 | | * To be on the safe side, always avoid hBits > 32. */ | 951 | 1.29G | assert(hBits <= 32); | 952 | | | 953 | 1.29G | switch(mls) | 954 | 1.29G | { | 955 | 10.8M | default: | 956 | 439M | case 4: return ZSTD_hash4PtrS(p, hBits, (U32)hashSalt); | 957 | 560M | case 5: return ZSTD_hash5PtrS(p, hBits, hashSalt); | 958 | 297M | case 6: return ZSTD_hash6PtrS(p, hBits, hashSalt); | 959 | 0 | case 7: return ZSTD_hash7PtrS(p, hBits, hashSalt); | 960 | 0 | case 8: return ZSTD_hash8PtrS(p, hBits, hashSalt); | 961 | 1.29G | } | 962 | 1.29G | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstd_opt.c:ZSTD_hashPtrSalted Unexecuted instantiation: zstdmt_compress.c:ZSTD_hashPtrSalted Unexecuted instantiation: fastcover.c:ZSTD_hashPtrSalted Unexecuted instantiation: zdict.c:ZSTD_hashPtrSalted |
963 | | |
964 | | |
965 | | /** ZSTD_ipow() : |
966 | | * Return base^exponent. |
967 | | */ |
968 | | static U64 ZSTD_ipow(U64 base, U64 exponent) |
969 | 15.3k | { |
970 | 15.3k | U64 power = 1; |
971 | 91.8k | while (exponent) { |
972 | 76.5k | if (exponent & 1) power *= base; |
973 | 76.5k | exponent >>= 1; |
974 | 76.5k | base *= base; |
975 | 76.5k | } |
976 | 15.3k | return power; |
977 | 15.3k | } Unexecuted instantiation: sequence_producer.c:ZSTD_ipow Unexecuted instantiation: zstd_compress.c:ZSTD_ipow Unexecuted instantiation: zstd_compress_literals.c:ZSTD_ipow Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_ipow Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_ipow Unexecuted instantiation: zstd_double_fast.c:ZSTD_ipow Unexecuted instantiation: zstd_fast.c:ZSTD_ipow Unexecuted instantiation: zstd_lazy.c:ZSTD_ipow Unexecuted instantiation: zstd_ldm.c:ZSTD_ipow Unexecuted instantiation: zstd_opt.c:ZSTD_ipow zstdmt_compress.c:ZSTD_ipow Line | Count | Source | 969 | 15.3k | { | 970 | 15.3k | U64 power = 1; | 971 | 91.8k | while (exponent) { | 972 | 76.5k | if (exponent & 1) power *= base; | 973 | 76.5k | exponent >>= 1; | 974 | 76.5k | base *= base; | 975 | 76.5k | } | 976 | 15.3k | return power; | 977 | 15.3k | } |
Unexecuted instantiation: fastcover.c:ZSTD_ipow Unexecuted instantiation: zdict.c:ZSTD_ipow |
978 | | |
979 | 635M | #define ZSTD_ROLL_HASH_CHAR_OFFSET 10 |
980 | | |
981 | | /** ZSTD_rollingHash_append() : |
982 | | * Add the buffer to the hash value. |
983 | | */ |
984 | | static U64 ZSTD_rollingHash_append(U64 hash, void const* buf, size_t size) |
985 | 7.99k | { |
986 | 7.99k | BYTE const* istart = (BYTE const*)buf; |
987 | 7.99k | size_t pos; |
988 | 262k | for (pos = 0; pos < size; ++pos) { |
989 | 254k | hash *= prime8bytes; |
990 | 254k | hash += istart[pos] + ZSTD_ROLL_HASH_CHAR_OFFSET; |
991 | 254k | } |
992 | 7.99k | return hash; |
993 | 7.99k | } Unexecuted instantiation: sequence_producer.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_compress.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_double_fast.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_fast.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_lazy.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_ldm.c:ZSTD_rollingHash_append Unexecuted instantiation: zstd_opt.c:ZSTD_rollingHash_append zstdmt_compress.c:ZSTD_rollingHash_append Line | Count | Source | 985 | 7.99k | { | 986 | 7.99k | BYTE const* istart = (BYTE const*)buf; | 987 | 7.99k | size_t pos; | 988 | 262k | for (pos = 0; pos < size; ++pos) { | 989 | 254k | hash *= prime8bytes; | 990 | 254k | hash += istart[pos] + ZSTD_ROLL_HASH_CHAR_OFFSET; | 991 | 254k | } | 992 | 7.99k | return hash; | 993 | 7.99k | } |
Unexecuted instantiation: fastcover.c:ZSTD_rollingHash_append Unexecuted instantiation: zdict.c:ZSTD_rollingHash_append |
994 | | |
995 | | /** ZSTD_rollingHash_compute() : |
996 | | * Compute the rolling hash value of the buffer. |
997 | | */ |
998 | | MEM_STATIC U64 ZSTD_rollingHash_compute(void const* buf, size_t size) |
999 | 7.96k | { |
1000 | 7.96k | return ZSTD_rollingHash_append(0, buf, size); |
1001 | 7.96k | } Unexecuted instantiation: sequence_producer.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_compress.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_double_fast.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_fast.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_lazy.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_ldm.c:ZSTD_rollingHash_compute Unexecuted instantiation: zstd_opt.c:ZSTD_rollingHash_compute zstdmt_compress.c:ZSTD_rollingHash_compute Line | Count | Source | 999 | 7.96k | { | 1000 | 7.96k | return ZSTD_rollingHash_append(0, buf, size); | 1001 | 7.96k | } |
Unexecuted instantiation: fastcover.c:ZSTD_rollingHash_compute Unexecuted instantiation: zdict.c:ZSTD_rollingHash_compute |
1002 | | |
1003 | | /** ZSTD_rollingHash_primePower() : |
1004 | | * Compute the primePower to be passed to ZSTD_rollingHash_rotate() for a hash |
1005 | | * over a window of length bytes. |
1006 | | */ |
1007 | | MEM_STATIC U64 ZSTD_rollingHash_primePower(U32 length) |
1008 | 15.3k | { |
1009 | 15.3k | return ZSTD_ipow(prime8bytes, length - 1); |
1010 | 15.3k | } Unexecuted instantiation: sequence_producer.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_compress.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_double_fast.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_fast.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_lazy.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_ldm.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zstd_opt.c:ZSTD_rollingHash_primePower zstdmt_compress.c:ZSTD_rollingHash_primePower Line | Count | Source | 1008 | 15.3k | { | 1009 | 15.3k | return ZSTD_ipow(prime8bytes, length - 1); | 1010 | 15.3k | } |
Unexecuted instantiation: fastcover.c:ZSTD_rollingHash_primePower Unexecuted instantiation: zdict.c:ZSTD_rollingHash_primePower |
1011 | | |
1012 | | /** ZSTD_rollingHash_rotate() : |
1013 | | * Rotate the rolling hash by one byte. |
1014 | | */ |
1015 | | MEM_STATIC U64 ZSTD_rollingHash_rotate(U64 hash, BYTE toRemove, BYTE toAdd, U64 primePower) |
1016 | 317M | { |
1017 | 317M | hash -= (toRemove + ZSTD_ROLL_HASH_CHAR_OFFSET) * primePower; |
1018 | 317M | hash *= prime8bytes; |
1019 | 317M | hash += toAdd + ZSTD_ROLL_HASH_CHAR_OFFSET; |
1020 | 317M | return hash; |
1021 | 317M | } Unexecuted instantiation: sequence_producer.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_compress.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_double_fast.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_fast.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_lazy.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_ldm.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zstd_opt.c:ZSTD_rollingHash_rotate zstdmt_compress.c:ZSTD_rollingHash_rotate Line | Count | Source | 1016 | 317M | { | 1017 | 317M | hash -= (toRemove + ZSTD_ROLL_HASH_CHAR_OFFSET) * primePower; | 1018 | 317M | hash *= prime8bytes; | 1019 | 317M | hash += toAdd + ZSTD_ROLL_HASH_CHAR_OFFSET; | 1020 | 317M | return hash; | 1021 | 317M | } |
Unexecuted instantiation: fastcover.c:ZSTD_rollingHash_rotate Unexecuted instantiation: zdict.c:ZSTD_rollingHash_rotate |
1022 | | |
1023 | | /*-************************************* |
1024 | | * Round buffer management |
1025 | | ***************************************/ |
1026 | | /* Max @current value allowed: |
1027 | | * In 32-bit mode: we want to avoid crossing the 2 GB limit, |
1028 | | * reducing risks of side effects in case of signed operations on indexes. |
1029 | | * In 64-bit mode: we want to ensure that adding the maximum job size (512 MB) |
1030 | | * doesn't overflow U32 index capacity (4 GB) */ |
1031 | 18.4E | #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB) |
1032 | | /* Maximum chunk size before overflow correction needs to be called again */ |
1033 | | #define ZSTD_CHUNKSIZE_MAX \ |
1034 | 4.01M | ( ((U32)-1) /* Maximum ending current index */ \ |
1035 | 4.01M | - ZSTD_CURRENT_MAX) /* Maximum beginning lowLimit */ |
1036 | | |
1037 | | /** |
1038 | | * ZSTD_window_clear(): |
1039 | | * Clears the window containing the history by simply setting it to empty. |
1040 | | */ |
1041 | | MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window) |
1042 | 4.00M | { |
1043 | 4.00M | size_t const endT = (size_t)(window->nextSrc - window->base); |
1044 | 4.00M | U32 const end = (U32)endT; |
1045 | | |
1046 | 4.00M | window->lowLimit = end; |
1047 | 4.00M | window->dictLimit = end; |
1048 | 4.00M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_clear zstd_compress.c:ZSTD_window_clear Line | Count | Source | 1042 | 4.00M | { | 1043 | 4.00M | size_t const endT = (size_t)(window->nextSrc - window->base); | 1044 | 4.00M | U32 const end = (U32)endT; | 1045 | | | 1046 | 4.00M | window->lowLimit = end; | 1047 | 4.00M | window->dictLimit = end; | 1048 | 4.00M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_clear Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_clear Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_clear Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_clear Unexecuted instantiation: zstd_fast.c:ZSTD_window_clear Unexecuted instantiation: zstd_lazy.c:ZSTD_window_clear Unexecuted instantiation: zstd_ldm.c:ZSTD_window_clear Unexecuted instantiation: zstd_opt.c:ZSTD_window_clear Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_clear Unexecuted instantiation: fastcover.c:ZSTD_window_clear Unexecuted instantiation: zdict.c:ZSTD_window_clear |
1049 | | |
1050 | | MEM_STATIC U32 ZSTD_window_isEmpty(ZSTD_window_t const window) |
1051 | 0 | { |
1052 | 0 | return window.dictLimit == ZSTD_WINDOW_START_INDEX && |
1053 | 0 | window.lowLimit == ZSTD_WINDOW_START_INDEX && |
1054 | 0 | (window.nextSrc - window.base) == ZSTD_WINDOW_START_INDEX; |
1055 | 0 | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_compress.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_fast.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_lazy.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_ldm.c:ZSTD_window_isEmpty Unexecuted instantiation: zstd_opt.c:ZSTD_window_isEmpty Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_isEmpty Unexecuted instantiation: fastcover.c:ZSTD_window_isEmpty Unexecuted instantiation: zdict.c:ZSTD_window_isEmpty |
1056 | | |
1057 | | /** |
1058 | | * ZSTD_window_hasExtDict(): |
1059 | | * Returns non-zero if the window has a non-empty extDict. |
1060 | | */ |
1061 | | MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window) |
1062 | 10.1M | { |
1063 | 10.1M | return window.lowLimit < window.dictLimit; |
1064 | 10.1M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_hasExtDict zstd_compress.c:ZSTD_window_hasExtDict Line | Count | Source | 1062 | 5.83M | { | 1063 | 5.83M | return window.lowLimit < window.dictLimit; | 1064 | 5.83M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_hasExtDict Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_hasExtDict Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_hasExtDict Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_hasExtDict Unexecuted instantiation: zstd_fast.c:ZSTD_window_hasExtDict Unexecuted instantiation: zstd_lazy.c:ZSTD_window_hasExtDict zstd_ldm.c:ZSTD_window_hasExtDict Line | Count | Source | 1062 | 2.26M | { | 1063 | 2.26M | return window.lowLimit < window.dictLimit; | 1064 | 2.26M | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_window_hasExtDict zstdmt_compress.c:ZSTD_window_hasExtDict Line | Count | Source | 1062 | 2.01M | { | 1063 | 2.01M | return window.lowLimit < window.dictLimit; | 1064 | 2.01M | } |
Unexecuted instantiation: fastcover.c:ZSTD_window_hasExtDict Unexecuted instantiation: zdict.c:ZSTD_window_hasExtDict |
1065 | | |
1066 | | /** |
1067 | | * ZSTD_matchState_dictMode(): |
1068 | | * Inspects the provided matchState and figures out what dictMode should be |
1069 | | * passed to the compressor. |
1070 | | */ |
1071 | | MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_MatchState_t *ms) |
1072 | 4.57M | { |
1073 | 4.57M | return ZSTD_window_hasExtDict(ms->window) ? |
1074 | 429k | ZSTD_extDict : |
1075 | 4.57M | ms->dictMatchState != NULL ? |
1076 | 1.40M | (ms->dictMatchState->dedicatedDictSearch ? ZSTD_dedicatedDictSearch : ZSTD_dictMatchState) : |
1077 | 4.14M | ZSTD_noDict; |
1078 | 4.57M | } Unexecuted instantiation: sequence_producer.c:ZSTD_matchState_dictMode zstd_compress.c:ZSTD_matchState_dictMode Line | Count | Source | 1072 | 3.82M | { | 1073 | 3.82M | return ZSTD_window_hasExtDict(ms->window) ? | 1074 | 328k | ZSTD_extDict : | 1075 | 3.82M | ms->dictMatchState != NULL ? | 1076 | 1.35M | (ms->dictMatchState->dedicatedDictSearch ? ZSTD_dedicatedDictSearch : ZSTD_dictMatchState) : | 1077 | 3.49M | ZSTD_noDict; | 1078 | 3.82M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstd_double_fast.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstd_fast.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstd_lazy.c:ZSTD_matchState_dictMode zstd_ldm.c:ZSTD_matchState_dictMode Line | Count | Source | 1072 | 746k | { | 1073 | 746k | return ZSTD_window_hasExtDict(ms->window) ? | 1074 | 101k | ZSTD_extDict : | 1075 | 746k | ms->dictMatchState != NULL ? | 1076 | 54.5k | (ms->dictMatchState->dedicatedDictSearch ? ZSTD_dedicatedDictSearch : ZSTD_dictMatchState) : | 1077 | 645k | ZSTD_noDict; | 1078 | 746k | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_matchState_dictMode Unexecuted instantiation: zstdmt_compress.c:ZSTD_matchState_dictMode Unexecuted instantiation: fastcover.c:ZSTD_matchState_dictMode Unexecuted instantiation: zdict.c:ZSTD_matchState_dictMode |
1079 | | |
1080 | | /* Defining this macro to non-zero tells zstd to run the overflow correction |
1081 | | * code much more frequently. This is very inefficient, and should only be |
1082 | | * used for tests and fuzzers. |
1083 | | */ |
1084 | | #ifndef ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY |
1085 | | # ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION |
1086 | 55.9M | # define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 1 |
1087 | | # else |
1088 | | # define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 0 |
1089 | | # endif |
1090 | | #endif |
1091 | | |
1092 | | /** |
1093 | | * ZSTD_window_canOverflowCorrect(): |
1094 | | * Returns non-zero if the indices are large enough for overflow correction |
1095 | | * to work correctly without impacting compression ratio. |
1096 | | */ |
1097 | | MEM_STATIC U32 ZSTD_window_canOverflowCorrect(ZSTD_window_t const window, |
1098 | | U32 cycleLog, |
1099 | | U32 maxDist, |
1100 | | U32 loadedDictEnd, |
1101 | | void const* src) |
1102 | 55.7M | { |
1103 | 55.7M | U32 const cycleSize = 1u << cycleLog; |
1104 | 55.7M | U32 const curr = (U32)((BYTE const*)src - window.base); |
1105 | 55.7M | U32 const minIndexToOverflowCorrect = cycleSize |
1106 | 55.7M | + MAX(maxDist, cycleSize) |
1107 | 55.7M | + ZSTD_WINDOW_START_INDEX; |
1108 | | |
1109 | | /* Adjust the min index to backoff the overflow correction frequency, |
1110 | | * so we don't waste too much CPU in overflow correction. If this |
1111 | | * computation overflows we don't really care, we just need to make |
1112 | | * sure it is at least minIndexToOverflowCorrect. |
1113 | | */ |
1114 | 55.7M | U32 const adjustment = window.nbOverflowCorrections + 1; |
1115 | 55.7M | U32 const adjustedIndex = MAX(minIndexToOverflowCorrect * adjustment, |
1116 | 55.7M | minIndexToOverflowCorrect); |
1117 | 55.7M | U32 const indexLargeEnough = curr > adjustedIndex; |
1118 | | |
1119 | | /* Only overflow correct early if the dictionary is invalidated already, |
1120 | | * so we don't hurt compression ratio. |
1121 | | */ |
1122 | 55.7M | U32 const dictionaryInvalidated = curr > maxDist + loadedDictEnd; |
1123 | | |
1124 | 55.7M | return indexLargeEnough && dictionaryInvalidated; |
1125 | 55.7M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_canOverflowCorrect zstd_compress.c:ZSTD_window_canOverflowCorrect Line | Count | Source | 1102 | 54.1M | { | 1103 | 54.1M | U32 const cycleSize = 1u << cycleLog; | 1104 | 54.1M | U32 const curr = (U32)((BYTE const*)src - window.base); | 1105 | 54.1M | U32 const minIndexToOverflowCorrect = cycleSize | 1106 | 54.1M | + MAX(maxDist, cycleSize) | 1107 | 54.1M | + ZSTD_WINDOW_START_INDEX; | 1108 | | | 1109 | | /* Adjust the min index to backoff the overflow correction frequency, | 1110 | | * so we don't waste too much CPU in overflow correction. If this | 1111 | | * computation overflows we don't really care, we just need to make | 1112 | | * sure it is at least minIndexToOverflowCorrect. | 1113 | | */ | 1114 | 54.1M | U32 const adjustment = window.nbOverflowCorrections + 1; | 1115 | 54.1M | U32 const adjustedIndex = MAX(minIndexToOverflowCorrect * adjustment, | 1116 | 54.1M | minIndexToOverflowCorrect); | 1117 | 54.1M | U32 const indexLargeEnough = curr > adjustedIndex; | 1118 | | | 1119 | | /* Only overflow correct early if the dictionary is invalidated already, | 1120 | | * so we don't hurt compression ratio. | 1121 | | */ | 1122 | 54.1M | U32 const dictionaryInvalidated = curr > maxDist + loadedDictEnd; | 1123 | | | 1124 | 54.1M | return indexLargeEnough && dictionaryInvalidated; | 1125 | 54.1M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstd_fast.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstd_lazy.c:ZSTD_window_canOverflowCorrect zstd_ldm.c:ZSTD_window_canOverflowCorrect Line | Count | Source | 1102 | 1.51M | { | 1103 | 1.51M | U32 const cycleSize = 1u << cycleLog; | 1104 | 1.51M | U32 const curr = (U32)((BYTE const*)src - window.base); | 1105 | 1.51M | U32 const minIndexToOverflowCorrect = cycleSize | 1106 | 1.51M | + MAX(maxDist, cycleSize) | 1107 | 1.51M | + ZSTD_WINDOW_START_INDEX; | 1108 | | | 1109 | | /* Adjust the min index to backoff the overflow correction frequency, | 1110 | | * so we don't waste too much CPU in overflow correction. If this | 1111 | | * computation overflows we don't really care, we just need to make | 1112 | | * sure it is at least minIndexToOverflowCorrect. | 1113 | | */ | 1114 | 1.51M | U32 const adjustment = window.nbOverflowCorrections + 1; | 1115 | 1.51M | U32 const adjustedIndex = MAX(minIndexToOverflowCorrect * adjustment, | 1116 | 1.51M | minIndexToOverflowCorrect); | 1117 | 1.51M | U32 const indexLargeEnough = curr > adjustedIndex; | 1118 | | | 1119 | | /* Only overflow correct early if the dictionary is invalidated already, | 1120 | | * so we don't hurt compression ratio. | 1121 | | */ | 1122 | 1.51M | U32 const dictionaryInvalidated = curr > maxDist + loadedDictEnd; | 1123 | | | 1124 | 1.51M | return indexLargeEnough && dictionaryInvalidated; | 1125 | 1.51M | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: fastcover.c:ZSTD_window_canOverflowCorrect Unexecuted instantiation: zdict.c:ZSTD_window_canOverflowCorrect |
1126 | | |
1127 | | /** |
1128 | | * ZSTD_window_needOverflowCorrection(): |
1129 | | * Returns non-zero if the indices are getting too large and need overflow |
1130 | | * protection. |
1131 | | */ |
1132 | | MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window, |
1133 | | U32 cycleLog, |
1134 | | U32 maxDist, |
1135 | | U32 loadedDictEnd, |
1136 | | void const* src, |
1137 | | void const* srcEnd) |
1138 | 55.7M | { |
1139 | 55.7M | U32 const curr = (U32)((BYTE const*)srcEnd - window.base); |
1140 | 55.7M | if (ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { |
1141 | 55.7M | if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) { |
1142 | 213k | return 1; |
1143 | 213k | } |
1144 | 55.7M | } |
1145 | 55.4M | return curr > ZSTD_CURRENT_MAX; |
1146 | 55.7M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_needOverflowCorrection zstd_compress.c:ZSTD_window_needOverflowCorrection Line | Count | Source | 1138 | 54.1M | { | 1139 | 54.1M | U32 const curr = (U32)((BYTE const*)srcEnd - window.base); | 1140 | 54.1M | if (ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { | 1141 | 54.1M | if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) { | 1142 | 165k | return 1; | 1143 | 165k | } | 1144 | 54.1M | } | 1145 | 54.0M | return curr > ZSTD_CURRENT_MAX; | 1146 | 54.1M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstd_fast.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstd_lazy.c:ZSTD_window_needOverflowCorrection zstd_ldm.c:ZSTD_window_needOverflowCorrection Line | Count | Source | 1138 | 1.51M | { | 1139 | 1.51M | U32 const curr = (U32)((BYTE const*)srcEnd - window.base); | 1140 | 1.51M | if (ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { | 1141 | 1.51M | if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) { | 1142 | 48.3k | return 1; | 1143 | 48.3k | } | 1144 | 1.51M | } | 1145 | 1.47M | return curr > ZSTD_CURRENT_MAX; | 1146 | 1.51M | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: fastcover.c:ZSTD_window_needOverflowCorrection Unexecuted instantiation: zdict.c:ZSTD_window_needOverflowCorrection |
1147 | | |
1148 | | /** |
1149 | | * ZSTD_window_correctOverflow(): |
1150 | | * Reduces the indices to protect from index overflow. |
1151 | | * Returns the correction made to the indices, which must be applied to every |
1152 | | * stored index. |
1153 | | * |
1154 | | * The least significant cycleLog bits of the indices must remain the same, |
1155 | | * which may be 0. Every index up to maxDist in the past must be valid. |
1156 | | */ |
1157 | | MEM_STATIC |
1158 | | ZSTD_ALLOW_POINTER_OVERFLOW_ATTR |
1159 | | U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, |
1160 | | U32 maxDist, void const* src) |
1161 | 213k | { |
1162 | | /* preemptive overflow correction: |
1163 | | * 1. correction is large enough: |
1164 | | * lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog |
1165 | | * 1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog |
1166 | | * |
1167 | | * current - newCurrent |
1168 | | * > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog) |
1169 | | * > (3<<29) - (1<<chainLog) |
1170 | | * > (3<<29) - (1<<30) (NOTE: chainLog <= 30) |
1171 | | * > 1<<29 |
1172 | | * |
1173 | | * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow: |
1174 | | * After correction, current is less than (1<<chainLog + 1<<windowLog). |
1175 | | * In 64-bit mode we are safe, because we have 64-bit ptrdiff_t. |
1176 | | * In 32-bit mode we are safe, because (chainLog <= 29), so |
1177 | | * ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32. |
1178 | | * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32: |
1179 | | * windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32. |
1180 | | */ |
1181 | 213k | U32 const cycleSize = 1u << cycleLog; |
1182 | 213k | U32 const cycleMask = cycleSize - 1; |
1183 | 213k | U32 const curr = (U32)((BYTE const*)src - window->base); |
1184 | 213k | U32 const currentCycle = curr & cycleMask; |
1185 | | /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */ |
1186 | 213k | U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX |
1187 | 213k | ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX) |
1188 | 213k | : 0; |
1189 | 213k | U32 const newCurrent = currentCycle |
1190 | 213k | + currentCycleCorrection |
1191 | 213k | + MAX(maxDist, cycleSize); |
1192 | 213k | U32 const correction = curr - newCurrent; |
1193 | | /* maxDist must be a power of two so that: |
1194 | | * (newCurrent & cycleMask) == (curr & cycleMask) |
1195 | | * This is required to not corrupt the chains / binary tree. |
1196 | | */ |
1197 | 213k | assert((maxDist & (maxDist - 1)) == 0); |
1198 | 213k | assert((curr & cycleMask) == (newCurrent & cycleMask)); |
1199 | 213k | assert(curr > newCurrent); |
1200 | 213k | if (!ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { |
1201 | | /* Loose bound, should be around 1<<29 (see above) */ |
1202 | 0 | assert(correction > 1<<28); |
1203 | 0 | } |
1204 | | |
1205 | 213k | window->base += correction; |
1206 | 213k | window->dictBase += correction; |
1207 | 213k | if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) { |
1208 | 124k | window->lowLimit = ZSTD_WINDOW_START_INDEX; |
1209 | 124k | } else { |
1210 | 88.6k | window->lowLimit -= correction; |
1211 | 88.6k | } |
1212 | 213k | if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) { |
1213 | 112k | window->dictLimit = ZSTD_WINDOW_START_INDEX; |
1214 | 112k | } else { |
1215 | 101k | window->dictLimit -= correction; |
1216 | 101k | } |
1217 | | |
1218 | | /* Ensure we can still reference the full window. */ |
1219 | 213k | assert(newCurrent >= maxDist); |
1220 | 213k | assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX); |
1221 | | /* Ensure that lowLimit and dictLimit didn't underflow. */ |
1222 | 213k | assert(window->lowLimit <= newCurrent); |
1223 | 213k | assert(window->dictLimit <= newCurrent); |
1224 | | |
1225 | 213k | ++window->nbOverflowCorrections; |
1226 | | |
1227 | 213k | DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction, |
1228 | 213k | window->lowLimit); |
1229 | 213k | return correction; |
1230 | 213k | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_correctOverflow zstd_compress.c:ZSTD_window_correctOverflow Line | Count | Source | 1161 | 165k | { | 1162 | | /* preemptive overflow correction: | 1163 | | * 1. correction is large enough: | 1164 | | * lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog | 1165 | | * 1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog | 1166 | | * | 1167 | | * current - newCurrent | 1168 | | * > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog) | 1169 | | * > (3<<29) - (1<<chainLog) | 1170 | | * > (3<<29) - (1<<30) (NOTE: chainLog <= 30) | 1171 | | * > 1<<29 | 1172 | | * | 1173 | | * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow: | 1174 | | * After correction, current is less than (1<<chainLog + 1<<windowLog). | 1175 | | * In 64-bit mode we are safe, because we have 64-bit ptrdiff_t. | 1176 | | * In 32-bit mode we are safe, because (chainLog <= 29), so | 1177 | | * ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32. | 1178 | | * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32: | 1179 | | * windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32. | 1180 | | */ | 1181 | 165k | U32 const cycleSize = 1u << cycleLog; | 1182 | 165k | U32 const cycleMask = cycleSize - 1; | 1183 | 165k | U32 const curr = (U32)((BYTE const*)src - window->base); | 1184 | 165k | U32 const currentCycle = curr & cycleMask; | 1185 | | /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */ | 1186 | 165k | U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX | 1187 | 165k | ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX) | 1188 | 165k | : 0; | 1189 | 165k | U32 const newCurrent = currentCycle | 1190 | 165k | + currentCycleCorrection | 1191 | 165k | + MAX(maxDist, cycleSize); | 1192 | 165k | U32 const correction = curr - newCurrent; | 1193 | | /* maxDist must be a power of two so that: | 1194 | | * (newCurrent & cycleMask) == (curr & cycleMask) | 1195 | | * This is required to not corrupt the chains / binary tree. | 1196 | | */ | 1197 | 165k | assert((maxDist & (maxDist - 1)) == 0); | 1198 | 165k | assert((curr & cycleMask) == (newCurrent & cycleMask)); | 1199 | 165k | assert(curr > newCurrent); | 1200 | 165k | if (!ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { | 1201 | | /* Loose bound, should be around 1<<29 (see above) */ | 1202 | 0 | assert(correction > 1<<28); | 1203 | 0 | } | 1204 | | | 1205 | 165k | window->base += correction; | 1206 | 165k | window->dictBase += correction; | 1207 | 165k | if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) { | 1208 | 124k | window->lowLimit = ZSTD_WINDOW_START_INDEX; | 1209 | 124k | } else { | 1210 | 40.5k | window->lowLimit -= correction; | 1211 | 40.5k | } | 1212 | 165k | if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) { | 1213 | 112k | window->dictLimit = ZSTD_WINDOW_START_INDEX; | 1214 | 112k | } else { | 1215 | 53.2k | window->dictLimit -= correction; | 1216 | 53.2k | } | 1217 | | | 1218 | | /* Ensure we can still reference the full window. */ | 1219 | 165k | assert(newCurrent >= maxDist); | 1220 | 165k | assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX); | 1221 | | /* Ensure that lowLimit and dictLimit didn't underflow. */ | 1222 | 165k | assert(window->lowLimit <= newCurrent); | 1223 | 165k | assert(window->dictLimit <= newCurrent); | 1224 | | | 1225 | 165k | ++window->nbOverflowCorrections; | 1226 | | | 1227 | 165k | DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction, | 1228 | 165k | window->lowLimit); | 1229 | 165k | return correction; | 1230 | 165k | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstd_fast.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstd_lazy.c:ZSTD_window_correctOverflow zstd_ldm.c:ZSTD_window_correctOverflow Line | Count | Source | 1161 | 48.3k | { | 1162 | | /* preemptive overflow correction: | 1163 | | * 1. correction is large enough: | 1164 | | * lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog | 1165 | | * 1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog | 1166 | | * | 1167 | | * current - newCurrent | 1168 | | * > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog) | 1169 | | * > (3<<29) - (1<<chainLog) | 1170 | | * > (3<<29) - (1<<30) (NOTE: chainLog <= 30) | 1171 | | * > 1<<29 | 1172 | | * | 1173 | | * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow: | 1174 | | * After correction, current is less than (1<<chainLog + 1<<windowLog). | 1175 | | * In 64-bit mode we are safe, because we have 64-bit ptrdiff_t. | 1176 | | * In 32-bit mode we are safe, because (chainLog <= 29), so | 1177 | | * ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32. | 1178 | | * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32: | 1179 | | * windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32. | 1180 | | */ | 1181 | 48.3k | U32 const cycleSize = 1u << cycleLog; | 1182 | 48.3k | U32 const cycleMask = cycleSize - 1; | 1183 | 48.3k | U32 const curr = (U32)((BYTE const*)src - window->base); | 1184 | 48.3k | U32 const currentCycle = curr & cycleMask; | 1185 | | /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */ | 1186 | 48.3k | U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX | 1187 | 48.3k | ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX) | 1188 | 48.3k | : 0; | 1189 | 48.3k | U32 const newCurrent = currentCycle | 1190 | 48.3k | + currentCycleCorrection | 1191 | 48.3k | + MAX(maxDist, cycleSize); | 1192 | 48.3k | U32 const correction = curr - newCurrent; | 1193 | | /* maxDist must be a power of two so that: | 1194 | | * (newCurrent & cycleMask) == (curr & cycleMask) | 1195 | | * This is required to not corrupt the chains / binary tree. | 1196 | | */ | 1197 | 48.3k | assert((maxDist & (maxDist - 1)) == 0); | 1198 | 48.3k | assert((curr & cycleMask) == (newCurrent & cycleMask)); | 1199 | 48.3k | assert(curr > newCurrent); | 1200 | 48.3k | if (!ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) { | 1201 | | /* Loose bound, should be around 1<<29 (see above) */ | 1202 | 0 | assert(correction > 1<<28); | 1203 | 0 | } | 1204 | | | 1205 | 48.3k | window->base += correction; | 1206 | 48.3k | window->dictBase += correction; | 1207 | 48.3k | if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) { | 1208 | 221 | window->lowLimit = ZSTD_WINDOW_START_INDEX; | 1209 | 48.1k | } else { | 1210 | 48.1k | window->lowLimit -= correction; | 1211 | 48.1k | } | 1212 | 48.3k | if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) { | 1213 | 0 | window->dictLimit = ZSTD_WINDOW_START_INDEX; | 1214 | 48.3k | } else { | 1215 | 48.3k | window->dictLimit -= correction; | 1216 | 48.3k | } | 1217 | | | 1218 | | /* Ensure we can still reference the full window. */ | 1219 | 48.3k | assert(newCurrent >= maxDist); | 1220 | 48.3k | assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX); | 1221 | | /* Ensure that lowLimit and dictLimit didn't underflow. */ | 1222 | 48.3k | assert(window->lowLimit <= newCurrent); | 1223 | 48.3k | assert(window->dictLimit <= newCurrent); | 1224 | | | 1225 | 48.3k | ++window->nbOverflowCorrections; | 1226 | | | 1227 | 48.3k | DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction, | 1228 | 48.3k | window->lowLimit); | 1229 | 48.3k | return correction; | 1230 | 48.3k | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_window_correctOverflow Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_correctOverflow Unexecuted instantiation: fastcover.c:ZSTD_window_correctOverflow Unexecuted instantiation: zdict.c:ZSTD_window_correctOverflow |
1231 | | |
1232 | | /** |
1233 | | * ZSTD_window_enforceMaxDist(): |
1234 | | * Updates lowLimit so that: |
1235 | | * (srcEnd - base) - lowLimit == maxDist + loadedDictEnd |
1236 | | * |
1237 | | * It ensures index is valid as long as index >= lowLimit. |
1238 | | * This must be called before a block compression call. |
1239 | | * |
1240 | | * loadedDictEnd is only defined if a dictionary is in use for current compression. |
1241 | | * As the name implies, loadedDictEnd represents the index at end of dictionary. |
1242 | | * The value lies within context's referential, it can be directly compared to blockEndIdx. |
1243 | | * |
1244 | | * If loadedDictEndPtr is NULL, no dictionary is in use, and we use loadedDictEnd == 0. |
1245 | | * If loadedDictEndPtr is not NULL, we set it to zero after updating lowLimit. |
1246 | | * This is because dictionaries are allowed to be referenced fully |
1247 | | * as long as the last byte of the dictionary is in the window. |
1248 | | * Once input has progressed beyond window size, dictionary cannot be referenced anymore. |
1249 | | * |
1250 | | * In normal dict mode, the dictionary lies between lowLimit and dictLimit. |
1251 | | * In dictMatchState mode, lowLimit and dictLimit are the same, |
1252 | | * and the dictionary is below them. |
1253 | | * forceWindow and dictMatchState are therefore incompatible. |
1254 | | */ |
1255 | | MEM_STATIC void |
1256 | | ZSTD_window_enforceMaxDist(ZSTD_window_t* window, |
1257 | | const void* blockEnd, |
1258 | | U32 maxDist, |
1259 | | U32* loadedDictEndPtr, |
1260 | | const ZSTD_MatchState_t** dictMatchStatePtr) |
1261 | 54.2M | { |
1262 | 54.2M | U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); |
1263 | 54.2M | U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0; |
1264 | 54.2M | DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", |
1265 | 54.2M | (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); |
1266 | | |
1267 | | /* - When there is no dictionary : loadedDictEnd == 0. |
1268 | | In which case, the test (blockEndIdx > maxDist) is merely to avoid |
1269 | | overflowing next operation `newLowLimit = blockEndIdx - maxDist`. |
1270 | | - When there is a standard dictionary : |
1271 | | Index referential is copied from the dictionary, |
1272 | | which means it starts from 0. |
1273 | | In which case, loadedDictEnd == dictSize, |
1274 | | and it makes sense to compare `blockEndIdx > maxDist + dictSize` |
1275 | | since `blockEndIdx` also starts from zero. |
1276 | | - When there is an attached dictionary : |
1277 | | loadedDictEnd is expressed within the referential of the context, |
1278 | | so it can be directly compared against blockEndIdx. |
1279 | | */ |
1280 | 54.2M | if (blockEndIdx > maxDist + loadedDictEnd) { |
1281 | 52.1M | U32 const newLowLimit = blockEndIdx - maxDist; |
1282 | 52.1M | if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit; |
1283 | 52.1M | if (window->dictLimit < window->lowLimit) { |
1284 | 2.67M | DEBUGLOG(5, "Update dictLimit to match lowLimit, from %u to %u", |
1285 | 2.67M | (unsigned)window->dictLimit, (unsigned)window->lowLimit); |
1286 | 2.67M | window->dictLimit = window->lowLimit; |
1287 | 2.67M | } |
1288 | | /* On reaching window size, dictionaries are invalidated */ |
1289 | 52.1M | if (loadedDictEndPtr) *loadedDictEndPtr = 0; |
1290 | 52.1M | if (dictMatchStatePtr) *dictMatchStatePtr = NULL; |
1291 | 52.1M | } |
1292 | 54.2M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_enforceMaxDist zstd_compress.c:ZSTD_window_enforceMaxDist Line | Count | Source | 1261 | 52.7M | { | 1262 | 52.7M | U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); | 1263 | 52.7M | U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0; | 1264 | 52.7M | DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", | 1265 | 52.7M | (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); | 1266 | | | 1267 | | /* - When there is no dictionary : loadedDictEnd == 0. | 1268 | | In which case, the test (blockEndIdx > maxDist) is merely to avoid | 1269 | | overflowing next operation `newLowLimit = blockEndIdx - maxDist`. | 1270 | | - When there is a standard dictionary : | 1271 | | Index referential is copied from the dictionary, | 1272 | | which means it starts from 0. | 1273 | | In which case, loadedDictEnd == dictSize, | 1274 | | and it makes sense to compare `blockEndIdx > maxDist + dictSize` | 1275 | | since `blockEndIdx` also starts from zero. | 1276 | | - When there is an attached dictionary : | 1277 | | loadedDictEnd is expressed within the referential of the context, | 1278 | | so it can be directly compared against blockEndIdx. | 1279 | | */ | 1280 | 52.7M | if (blockEndIdx > maxDist + loadedDictEnd) { | 1281 | 50.8M | U32 const newLowLimit = blockEndIdx - maxDist; | 1282 | 50.8M | if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit; | 1283 | 50.8M | if (window->dictLimit < window->lowLimit) { | 1284 | 1.47M | DEBUGLOG(5, "Update dictLimit to match lowLimit, from %u to %u", | 1285 | 1.47M | (unsigned)window->dictLimit, (unsigned)window->lowLimit); | 1286 | 1.47M | window->dictLimit = window->lowLimit; | 1287 | 1.47M | } | 1288 | | /* On reaching window size, dictionaries are invalidated */ | 1289 | 50.8M | if (loadedDictEndPtr) *loadedDictEndPtr = 0; | 1290 | 50.8M | if (dictMatchStatePtr) *dictMatchStatePtr = NULL; | 1291 | 50.8M | } | 1292 | 52.7M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstd_fast.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstd_lazy.c:ZSTD_window_enforceMaxDist zstd_ldm.c:ZSTD_window_enforceMaxDist Line | Count | Source | 1261 | 1.51M | { | 1262 | 1.51M | U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); | 1263 | 1.51M | U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0; | 1264 | 1.51M | DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", | 1265 | 1.51M | (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); | 1266 | | | 1267 | | /* - When there is no dictionary : loadedDictEnd == 0. | 1268 | | In which case, the test (blockEndIdx > maxDist) is merely to avoid | 1269 | | overflowing next operation `newLowLimit = blockEndIdx - maxDist`. | 1270 | | - When there is a standard dictionary : | 1271 | | Index referential is copied from the dictionary, | 1272 | | which means it starts from 0. | 1273 | | In which case, loadedDictEnd == dictSize, | 1274 | | and it makes sense to compare `blockEndIdx > maxDist + dictSize` | 1275 | | since `blockEndIdx` also starts from zero. | 1276 | | - When there is an attached dictionary : | 1277 | | loadedDictEnd is expressed within the referential of the context, | 1278 | | so it can be directly compared against blockEndIdx. | 1279 | | */ | 1280 | 1.51M | if (blockEndIdx > maxDist + loadedDictEnd) { | 1281 | 1.26M | U32 const newLowLimit = blockEndIdx - maxDist; | 1282 | 1.26M | if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit; | 1283 | 1.26M | if (window->dictLimit < window->lowLimit) { | 1284 | 1.19M | DEBUGLOG(5, "Update dictLimit to match lowLimit, from %u to %u", | 1285 | 1.19M | (unsigned)window->dictLimit, (unsigned)window->lowLimit); | 1286 | 1.19M | window->dictLimit = window->lowLimit; | 1287 | 1.19M | } | 1288 | | /* On reaching window size, dictionaries are invalidated */ | 1289 | 1.26M | if (loadedDictEndPtr) *loadedDictEndPtr = 0; | 1290 | 1.26M | if (dictMatchStatePtr) *dictMatchStatePtr = NULL; | 1291 | 1.26M | } | 1292 | 1.51M | } |
Unexecuted instantiation: zstd_opt.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zstdmt_compress.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: fastcover.c:ZSTD_window_enforceMaxDist Unexecuted instantiation: zdict.c:ZSTD_window_enforceMaxDist |
1293 | | |
1294 | | /* Similar to ZSTD_window_enforceMaxDist(), |
1295 | | * but only invalidates dictionary |
1296 | | * when input progresses beyond window size. |
1297 | | * assumption : loadedDictEndPtr and dictMatchStatePtr are valid (non NULL) |
1298 | | * loadedDictEnd uses same referential as window->base |
1299 | | * maxDist is the window size */ |
1300 | | MEM_STATIC void |
1301 | | ZSTD_checkDictValidity(const ZSTD_window_t* window, |
1302 | | const void* blockEnd, |
1303 | | U32 maxDist, |
1304 | | U32* loadedDictEndPtr, |
1305 | | const ZSTD_MatchState_t** dictMatchStatePtr) |
1306 | 52.7M | { |
1307 | 52.7M | assert(loadedDictEndPtr != NULL); |
1308 | 52.7M | assert(dictMatchStatePtr != NULL); |
1309 | 52.7M | { U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); |
1310 | 52.7M | U32 const loadedDictEnd = *loadedDictEndPtr; |
1311 | 52.7M | DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", |
1312 | 52.7M | (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); |
1313 | 52.7M | assert(blockEndIdx >= loadedDictEnd); |
1314 | | |
1315 | 52.7M | if (blockEndIdx > loadedDictEnd + maxDist || loadedDictEnd != window->dictLimit) { |
1316 | | /* On reaching window size, dictionaries are invalidated. |
1317 | | * For simplification, if window size is reached anywhere within next block, |
1318 | | * the dictionary is invalidated for the full block. |
1319 | | * |
1320 | | * We also have to invalidate the dictionary if ZSTD_window_update() has detected |
1321 | | * non-contiguous segments, which means that loadedDictEnd != window->dictLimit. |
1322 | | * loadedDictEnd may be 0, if forceWindow is true, but in that case we never use |
1323 | | * dictMatchState, so setting it to NULL is not a problem. |
1324 | | */ |
1325 | 51.9M | DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)"); |
1326 | 51.9M | *loadedDictEndPtr = 0; |
1327 | 51.9M | *dictMatchStatePtr = NULL; |
1328 | 51.9M | } else { |
1329 | 768k | if (*loadedDictEndPtr != 0) { |
1330 | 768k | DEBUGLOG(6, "dictionary considered valid for current block"); |
1331 | 768k | } } } |
1332 | 52.7M | } Unexecuted instantiation: sequence_producer.c:ZSTD_checkDictValidity zstd_compress.c:ZSTD_checkDictValidity Line | Count | Source | 1306 | 52.7M | { | 1307 | 52.7M | assert(loadedDictEndPtr != NULL); | 1308 | 52.7M | assert(dictMatchStatePtr != NULL); | 1309 | 52.7M | { U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); | 1310 | 52.7M | U32 const loadedDictEnd = *loadedDictEndPtr; | 1311 | 52.7M | DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", | 1312 | 52.7M | (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); | 1313 | 52.7M | assert(blockEndIdx >= loadedDictEnd); | 1314 | | | 1315 | 52.7M | if (blockEndIdx > loadedDictEnd + maxDist || loadedDictEnd != window->dictLimit) { | 1316 | | /* On reaching window size, dictionaries are invalidated. | 1317 | | * For simplification, if window size is reached anywhere within next block, | 1318 | | * the dictionary is invalidated for the full block. | 1319 | | * | 1320 | | * We also have to invalidate the dictionary if ZSTD_window_update() has detected | 1321 | | * non-contiguous segments, which means that loadedDictEnd != window->dictLimit. | 1322 | | * loadedDictEnd may be 0, if forceWindow is true, but in that case we never use | 1323 | | * dictMatchState, so setting it to NULL is not a problem. | 1324 | | */ | 1325 | 51.9M | DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)"); | 1326 | 51.9M | *loadedDictEndPtr = 0; | 1327 | 51.9M | *dictMatchStatePtr = NULL; | 1328 | 51.9M | } else { | 1329 | 768k | if (*loadedDictEndPtr != 0) { | 1330 | 768k | DEBUGLOG(6, "dictionary considered valid for current block"); | 1331 | 768k | } } } | 1332 | 52.7M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_double_fast.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_fast.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_lazy.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_ldm.c:ZSTD_checkDictValidity Unexecuted instantiation: zstd_opt.c:ZSTD_checkDictValidity Unexecuted instantiation: zstdmt_compress.c:ZSTD_checkDictValidity Unexecuted instantiation: fastcover.c:ZSTD_checkDictValidity Unexecuted instantiation: zdict.c:ZSTD_checkDictValidity |
1333 | | |
1334 | 549k | MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { |
1335 | 549k | ZSTD_memset(window, 0, sizeof(*window)); |
1336 | 549k | window->base = (BYTE const*)" "; |
1337 | 549k | window->dictBase = (BYTE const*)" "; |
1338 | 549k | ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */ |
1339 | 549k | window->dictLimit = ZSTD_WINDOW_START_INDEX; /* start from >0, so that 1st position is valid */ |
1340 | 549k | window->lowLimit = ZSTD_WINDOW_START_INDEX; /* it ensures first and later CCtx usages compress the same */ |
1341 | 549k | window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX; /* see issue #1241 */ |
1342 | 549k | window->nbOverflowCorrections = 0; |
1343 | 549k | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_init zstd_compress.c:ZSTD_window_init Line | Count | Source | 1334 | 536k | MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { | 1335 | 536k | ZSTD_memset(window, 0, sizeof(*window)); | 1336 | 536k | window->base = (BYTE const*)" "; | 1337 | 536k | window->dictBase = (BYTE const*)" "; | 1338 | 536k | ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */ | 1339 | 536k | window->dictLimit = ZSTD_WINDOW_START_INDEX; /* start from >0, so that 1st position is valid */ | 1340 | 536k | window->lowLimit = ZSTD_WINDOW_START_INDEX; /* it ensures first and later CCtx usages compress the same */ | 1341 | 536k | window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX; /* see issue #1241 */ | 1342 | 536k | window->nbOverflowCorrections = 0; | 1343 | 536k | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_init Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_init Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_init Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_init Unexecuted instantiation: zstd_fast.c:ZSTD_window_init Unexecuted instantiation: zstd_lazy.c:ZSTD_window_init Unexecuted instantiation: zstd_ldm.c:ZSTD_window_init Unexecuted instantiation: zstd_opt.c:ZSTD_window_init zstdmt_compress.c:ZSTD_window_init Line | Count | Source | 1334 | 13.5k | MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { | 1335 | 13.5k | ZSTD_memset(window, 0, sizeof(*window)); | 1336 | 13.5k | window->base = (BYTE const*)" "; | 1337 | 13.5k | window->dictBase = (BYTE const*)" "; | 1338 | 13.5k | ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */ | 1339 | 13.5k | window->dictLimit = ZSTD_WINDOW_START_INDEX; /* start from >0, so that 1st position is valid */ | 1340 | 13.5k | window->lowLimit = ZSTD_WINDOW_START_INDEX; /* it ensures first and later CCtx usages compress the same */ | 1341 | 13.5k | window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX; /* see issue #1241 */ | 1342 | 13.5k | window->nbOverflowCorrections = 0; | 1343 | 13.5k | } |
Unexecuted instantiation: fastcover.c:ZSTD_window_init Unexecuted instantiation: zdict.c:ZSTD_window_init |
1344 | | |
1345 | | /** |
1346 | | * ZSTD_window_update(): |
1347 | | * Updates the window by appending [src, src + srcSize) to the window. |
1348 | | * If it is not contiguous, the current prefix becomes the extDict, and we |
1349 | | * forget about the extDict. Handles overlap of the prefix and extDict. |
1350 | | * Returns non-zero if the segment is contiguous. |
1351 | | */ |
1352 | | MEM_STATIC |
1353 | | ZSTD_ALLOW_POINTER_OVERFLOW_ATTR |
1354 | | U32 ZSTD_window_update(ZSTD_window_t* window, |
1355 | | const void* src, size_t srcSize, |
1356 | | int forceNonContiguous) |
1357 | 56.1M | { |
1358 | 56.1M | BYTE const* const ip = (BYTE const*)src; |
1359 | 56.1M | U32 contiguous = 1; |
1360 | 56.1M | DEBUGLOG(5, "ZSTD_window_update"); |
1361 | 56.1M | if (srcSize == 0) |
1362 | 0 | return contiguous; |
1363 | 56.1M | assert(window->base != NULL); |
1364 | 56.1M | assert(window->dictBase != NULL); |
1365 | | /* Check if blocks follow each other */ |
1366 | 56.1M | if (src != window->nextSrc || forceNonContiguous) { |
1367 | | /* not contiguous */ |
1368 | 999k | size_t const distanceFromBase = (size_t)(window->nextSrc - window->base); |
1369 | 999k | DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit); |
1370 | 999k | window->lowLimit = window->dictLimit; |
1371 | 999k | assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */ |
1372 | 999k | window->dictLimit = (U32)distanceFromBase; |
1373 | 999k | window->dictBase = window->base; |
1374 | 999k | window->base = ip - distanceFromBase; |
1375 | | /* ms->nextToUpdate = window->dictLimit; */ |
1376 | 999k | if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */ |
1377 | 999k | contiguous = 0; |
1378 | 999k | } |
1379 | 56.1M | window->nextSrc = ip + srcSize; |
1380 | | /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */ |
1381 | 56.1M | if ( (ip+srcSize > window->dictBase + window->lowLimit) |
1382 | 56.1M | & (ip < window->dictBase + window->dictLimit)) { |
1383 | 49.1M | size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase); |
1384 | 49.1M | U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx; |
1385 | 49.1M | assert(highInputIdx < UINT_MAX); |
1386 | 49.1M | window->lowLimit = lowLimitMax; |
1387 | 49.1M | DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit); |
1388 | 49.1M | } |
1389 | 56.1M | return contiguous; |
1390 | 56.1M | } Unexecuted instantiation: sequence_producer.c:ZSTD_window_update zstd_compress.c:ZSTD_window_update Line | Count | Source | 1357 | 55.0M | { | 1358 | 55.0M | BYTE const* const ip = (BYTE const*)src; | 1359 | 55.0M | U32 contiguous = 1; | 1360 | 55.0M | DEBUGLOG(5, "ZSTD_window_update"); | 1361 | 55.0M | if (srcSize == 0) | 1362 | 0 | return contiguous; | 1363 | 55.0M | assert(window->base != NULL); | 1364 | 55.0M | assert(window->dictBase != NULL); | 1365 | | /* Check if blocks follow each other */ | 1366 | 55.0M | if (src != window->nextSrc || forceNonContiguous) { | 1367 | | /* not contiguous */ | 1368 | 985k | size_t const distanceFromBase = (size_t)(window->nextSrc - window->base); | 1369 | 985k | DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit); | 1370 | 985k | window->lowLimit = window->dictLimit; | 1371 | 985k | assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */ | 1372 | 985k | window->dictLimit = (U32)distanceFromBase; | 1373 | 985k | window->dictBase = window->base; | 1374 | 985k | window->base = ip - distanceFromBase; | 1375 | | /* ms->nextToUpdate = window->dictLimit; */ | 1376 | 985k | if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */ | 1377 | 985k | contiguous = 0; | 1378 | 985k | } | 1379 | 55.0M | window->nextSrc = ip + srcSize; | 1380 | | /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */ | 1381 | 55.0M | if ( (ip+srcSize > window->dictBase + window->lowLimit) | 1382 | 55.0M | & (ip < window->dictBase + window->dictLimit)) { | 1383 | 49.1M | size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase); | 1384 | 49.1M | U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx; | 1385 | 49.1M | assert(highInputIdx < UINT_MAX); | 1386 | 49.1M | window->lowLimit = lowLimitMax; | 1387 | 49.1M | DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit); | 1388 | 49.1M | } | 1389 | 55.0M | return contiguous; | 1390 | 55.0M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_window_update Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_window_update Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_window_update Unexecuted instantiation: zstd_double_fast.c:ZSTD_window_update Unexecuted instantiation: zstd_fast.c:ZSTD_window_update Unexecuted instantiation: zstd_lazy.c:ZSTD_window_update Unexecuted instantiation: zstd_ldm.c:ZSTD_window_update Unexecuted instantiation: zstd_opt.c:ZSTD_window_update zstdmt_compress.c:ZSTD_window_update Line | Count | Source | 1357 | 1.03M | { | 1358 | 1.03M | BYTE const* const ip = (BYTE const*)src; | 1359 | 1.03M | U32 contiguous = 1; | 1360 | 1.03M | DEBUGLOG(5, "ZSTD_window_update"); | 1361 | 1.03M | if (srcSize == 0) | 1362 | 0 | return contiguous; | 1363 | 1.03M | assert(window->base != NULL); | 1364 | 1.03M | assert(window->dictBase != NULL); | 1365 | | /* Check if blocks follow each other */ | 1366 | 1.03M | if (src != window->nextSrc || forceNonContiguous) { | 1367 | | /* not contiguous */ | 1368 | 14.3k | size_t const distanceFromBase = (size_t)(window->nextSrc - window->base); | 1369 | 14.3k | DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit); | 1370 | 14.3k | window->lowLimit = window->dictLimit; | 1371 | 14.3k | assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */ | 1372 | 14.3k | window->dictLimit = (U32)distanceFromBase; | 1373 | 14.3k | window->dictBase = window->base; | 1374 | 14.3k | window->base = ip - distanceFromBase; | 1375 | | /* ms->nextToUpdate = window->dictLimit; */ | 1376 | 14.3k | if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */ | 1377 | 14.3k | contiguous = 0; | 1378 | 14.3k | } | 1379 | 1.03M | window->nextSrc = ip + srcSize; | 1380 | | /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */ | 1381 | 1.03M | if ( (ip+srcSize > window->dictBase + window->lowLimit) | 1382 | 1.03M | & (ip < window->dictBase + window->dictLimit)) { | 1383 | 0 | size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase); | 1384 | 0 | U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx; | 1385 | 0 | assert(highInputIdx < UINT_MAX); | 1386 | 0 | window->lowLimit = lowLimitMax; | 1387 | 0 | DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit); | 1388 | 0 | } | 1389 | 1.03M | return contiguous; | 1390 | 1.03M | } |
Unexecuted instantiation: fastcover.c:ZSTD_window_update Unexecuted instantiation: zdict.c:ZSTD_window_update |
1391 | | |
1392 | | /** |
1393 | | * Returns the lowest allowed match index. It may either be in the ext-dict or the prefix. |
1394 | | */ |
1395 | | MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_MatchState_t* ms, U32 curr, unsigned windowLog) |
1396 | 1.16G | { |
1397 | 1.16G | U32 const maxDistance = 1U << windowLog; |
1398 | 1.16G | U32 const lowestValid = ms->window.lowLimit; |
1399 | 1.16G | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; |
1400 | 1.16G | U32 const isDictionary = (ms->loadedDictEnd != 0); |
1401 | | /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary |
1402 | | * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't |
1403 | | * valid for the entire block. So this check is sufficient to find the lowest valid match index. |
1404 | | */ |
1405 | 1.16G | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; |
1406 | 1.16G | return matchLowest; |
1407 | 1.16G | } Unexecuted instantiation: sequence_producer.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: zstd_compress.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: zstd_compress_literals.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_getLowestMatchIndex zstd_double_fast.c:ZSTD_getLowestMatchIndex Line | Count | Source | 1396 | 202k | { | 1397 | 202k | U32 const maxDistance = 1U << windowLog; | 1398 | 202k | U32 const lowestValid = ms->window.lowLimit; | 1399 | 202k | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1400 | 202k | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1401 | | /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary | 1402 | | * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't | 1403 | | * valid for the entire block. So this check is sufficient to find the lowest valid match index. | 1404 | | */ | 1405 | 202k | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1406 | 202k | return matchLowest; | 1407 | 202k | } |
zstd_fast.c:ZSTD_getLowestMatchIndex Line | Count | Source | 1396 | 233k | { | 1397 | 233k | U32 const maxDistance = 1U << windowLog; | 1398 | 233k | U32 const lowestValid = ms->window.lowLimit; | 1399 | 233k | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1400 | 233k | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1401 | | /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary | 1402 | | * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't | 1403 | | * valid for the entire block. So this check is sufficient to find the lowest valid match index. | 1404 | | */ | 1405 | 233k | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1406 | 233k | return matchLowest; | 1407 | 233k | } |
zstd_lazy.c:ZSTD_getLowestMatchIndex Line | Count | Source | 1396 | 146M | { | 1397 | 146M | U32 const maxDistance = 1U << windowLog; | 1398 | 146M | U32 const lowestValid = ms->window.lowLimit; | 1399 | 146M | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1400 | 146M | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1401 | | /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary | 1402 | | * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't | 1403 | | * valid for the entire block. So this check is sufficient to find the lowest valid match index. | 1404 | | */ | 1405 | 146M | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1406 | 146M | return matchLowest; | 1407 | 146M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_getLowestMatchIndex zstd_opt.c:ZSTD_getLowestMatchIndex Line | Count | Source | 1396 | 1.01G | { | 1397 | 1.01G | U32 const maxDistance = 1U << windowLog; | 1398 | 1.01G | U32 const lowestValid = ms->window.lowLimit; | 1399 | 1.01G | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1400 | 1.01G | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1401 | | /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary | 1402 | | * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't | 1403 | | * valid for the entire block. So this check is sufficient to find the lowest valid match index. | 1404 | | */ | 1405 | 1.01G | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1406 | 1.01G | return matchLowest; | 1407 | 1.01G | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: fastcover.c:ZSTD_getLowestMatchIndex Unexecuted instantiation: zdict.c:ZSTD_getLowestMatchIndex |
1408 | | |
1409 | | /** |
1410 | | * Returns the lowest allowed match index in the prefix. |
1411 | | */ |
1412 | | MEM_STATIC U32 ZSTD_getLowestPrefixIndex(const ZSTD_MatchState_t* ms, U32 curr, unsigned windowLog) |
1413 | 10.9M | { |
1414 | 10.9M | U32 const maxDistance = 1U << windowLog; |
1415 | 10.9M | U32 const lowestValid = ms->window.dictLimit; |
1416 | 10.9M | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; |
1417 | 10.9M | U32 const isDictionary = (ms->loadedDictEnd != 0); |
1418 | | /* When computing the lowest prefix index we need to take the dictionary into account to handle |
1419 | | * the edge case where the dictionary and the source are contiguous in memory. |
1420 | | */ |
1421 | 10.9M | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; |
1422 | 10.9M | return matchLowest; |
1423 | 10.9M | } Unexecuted instantiation: sequence_producer.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstd_compress.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstd_compress_literals.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_getLowestPrefixIndex zstd_double_fast.c:ZSTD_getLowestPrefixIndex Line | Count | Source | 1413 | 4.56M | { | 1414 | 4.56M | U32 const maxDistance = 1U << windowLog; | 1415 | 4.56M | U32 const lowestValid = ms->window.dictLimit; | 1416 | 4.56M | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1417 | 4.56M | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1418 | | /* When computing the lowest prefix index we need to take the dictionary into account to handle | 1419 | | * the edge case where the dictionary and the source are contiguous in memory. | 1420 | | */ | 1421 | 4.56M | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1422 | 4.56M | return matchLowest; | 1423 | 4.56M | } |
zstd_fast.c:ZSTD_getLowestPrefixIndex Line | Count | Source | 1413 | 2.81M | { | 1414 | 2.81M | U32 const maxDistance = 1U << windowLog; | 1415 | 2.81M | U32 const lowestValid = ms->window.dictLimit; | 1416 | 2.81M | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1417 | 2.81M | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1418 | | /* When computing the lowest prefix index we need to take the dictionary into account to handle | 1419 | | * the edge case where the dictionary and the source are contiguous in memory. | 1420 | | */ | 1421 | 2.81M | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1422 | 2.81M | return matchLowest; | 1423 | 2.81M | } |
zstd_lazy.c:ZSTD_getLowestPrefixIndex Line | Count | Source | 1413 | 3.56M | { | 1414 | 3.56M | U32 const maxDistance = 1U << windowLog; | 1415 | 3.56M | U32 const lowestValid = ms->window.dictLimit; | 1416 | 3.56M | U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; | 1417 | 3.56M | U32 const isDictionary = (ms->loadedDictEnd != 0); | 1418 | | /* When computing the lowest prefix index we need to take the dictionary into account to handle | 1419 | | * the edge case where the dictionary and the source are contiguous in memory. | 1420 | | */ | 1421 | 3.56M | U32 const matchLowest = isDictionary ? lowestValid : withinWindow; | 1422 | 3.56M | return matchLowest; | 1423 | 3.56M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstd_opt.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zstdmt_compress.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: fastcover.c:ZSTD_getLowestPrefixIndex Unexecuted instantiation: zdict.c:ZSTD_getLowestPrefixIndex |
1424 | | |
1425 | | /* index_safety_check: |
1426 | | * intentional underflow : ensure repIndex isn't overlapping dict + prefix |
1427 | | * @return 1 if values are not overlapping, |
1428 | | * 0 otherwise */ |
1429 | 260M | MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) { |
1430 | 260M | return ((U32)((prefixLowestIndex-1) - repIndex) >= 3); |
1431 | 260M | } Unexecuted instantiation: sequence_producer.c:ZSTD_index_overlap_check Unexecuted instantiation: zstd_compress.c:ZSTD_index_overlap_check Unexecuted instantiation: zstd_compress_literals.c:ZSTD_index_overlap_check Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_index_overlap_check Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_index_overlap_check zstd_double_fast.c:ZSTD_index_overlap_check Line | Count | Source | 1429 | 23.4M | MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) { | 1430 | 23.4M | return ((U32)((prefixLowestIndex-1) - repIndex) >= 3); | 1431 | 23.4M | } |
zstd_fast.c:ZSTD_index_overlap_check Line | Count | Source | 1429 | 98.9M | MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) { | 1430 | 98.9M | return ((U32)((prefixLowestIndex-1) - repIndex) >= 3); | 1431 | 98.9M | } |
zstd_lazy.c:ZSTD_index_overlap_check Line | Count | Source | 1429 | 84.1M | MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) { | 1430 | 84.1M | return ((U32)((prefixLowestIndex-1) - repIndex) >= 3); | 1431 | 84.1M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_index_overlap_check zstd_opt.c:ZSTD_index_overlap_check Line | Count | Source | 1429 | 54.1M | MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) { | 1430 | 54.1M | return ((U32)((prefixLowestIndex-1) - repIndex) >= 3); | 1431 | 54.1M | } |
Unexecuted instantiation: zstdmt_compress.c:ZSTD_index_overlap_check Unexecuted instantiation: fastcover.c:ZSTD_index_overlap_check Unexecuted instantiation: zdict.c:ZSTD_index_overlap_check |
1432 | | |
1433 | | |
1434 | | /* debug functions */ |
1435 | | #if (DEBUGLEVEL>=2) |
1436 | | |
1437 | | MEM_STATIC double ZSTD_fWeight(U32 rawStat) |
1438 | | { |
1439 | | U32 const fp_accuracy = 8; |
1440 | | U32 const fp_multiplier = (1 << fp_accuracy); |
1441 | | U32 const newStat = rawStat + 1; |
1442 | | U32 const hb = ZSTD_highbit32(newStat); |
1443 | | U32 const BWeight = hb * fp_multiplier; |
1444 | | U32 const FWeight = (newStat << fp_accuracy) >> hb; |
1445 | | U32 const weight = BWeight + FWeight; |
1446 | | assert(hb + fp_accuracy < 31); |
1447 | | return (double)weight / fp_multiplier; |
1448 | | } |
1449 | | |
1450 | | /* display a table content, |
1451 | | * listing each element, its frequency, and its predicted bit cost */ |
1452 | | MEM_STATIC void ZSTD_debugTable(const U32* table, U32 max) |
1453 | | { |
1454 | | unsigned u, sum; |
1455 | | for (u=0, sum=0; u<=max; u++) sum += table[u]; |
1456 | | DEBUGLOG(2, "total nb elts: %u", sum); |
1457 | | for (u=0; u<=max; u++) { |
1458 | | DEBUGLOG(2, "%2u: %5u (%.2f)", |
1459 | | u, table[u], ZSTD_fWeight(sum) - ZSTD_fWeight(table[u]) ); |
1460 | | } |
1461 | | } |
1462 | | |
1463 | | #endif |
1464 | | |
1465 | | /* Short Cache */ |
1466 | | |
1467 | | /* Normally, zstd matchfinders follow this flow: |
1468 | | * 1. Compute hash at ip |
1469 | | * 2. Load index from hashTable[hash] |
1470 | | * 3. Check if *ip == *(base + index) |
1471 | | * In dictionary compression, loading *(base + index) is often an L2 or even L3 miss. |
1472 | | * |
1473 | | * Short cache is an optimization which allows us to avoid step 3 most of the time |
1474 | | * when the data doesn't actually match. With short cache, the flow becomes: |
1475 | | * 1. Compute (hash, currentTag) at ip. currentTag is an 8-bit independent hash at ip. |
1476 | | * 2. Load (index, matchTag) from hashTable[hash]. See ZSTD_writeTaggedIndex to understand how this works. |
1477 | | * 3. Only if currentTag == matchTag, check *ip == *(base + index). Otherwise, continue. |
1478 | | * |
1479 | | * Currently, short cache is only implemented in CDict hashtables. Thus, its use is limited to |
1480 | | * dictMatchState matchfinders. |
1481 | | */ |
1482 | 1.86G | #define ZSTD_SHORT_CACHE_TAG_BITS 8 |
1483 | 521M | #define ZSTD_SHORT_CACHE_TAG_MASK ((1u << ZSTD_SHORT_CACHE_TAG_BITS) - 1) |
1484 | | |
1485 | | /* Helper function for ZSTD_fillHashTable and ZSTD_fillDoubleHashTable. |
1486 | | * Unpacks hashAndTag into (hash, tag), then packs (index, tag) into hashTable[hash]. */ |
1487 | 346M | MEM_STATIC void ZSTD_writeTaggedIndex(U32* const hashTable, size_t hashAndTag, U32 index) { |
1488 | 346M | size_t const hash = hashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS; |
1489 | 346M | U32 const tag = (U32)(hashAndTag & ZSTD_SHORT_CACHE_TAG_MASK); |
1490 | 346M | assert(index >> (32 - ZSTD_SHORT_CACHE_TAG_BITS) == 0); |
1491 | 346M | hashTable[hash] = (index << ZSTD_SHORT_CACHE_TAG_BITS) | tag; |
1492 | 346M | } Unexecuted instantiation: sequence_producer.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_compress.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_compress_literals.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_writeTaggedIndex zstd_double_fast.c:ZSTD_writeTaggedIndex Line | Count | Source | 1487 | 290M | MEM_STATIC void ZSTD_writeTaggedIndex(U32* const hashTable, size_t hashAndTag, U32 index) { | 1488 | 290M | size_t const hash = hashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS; | 1489 | 290M | U32 const tag = (U32)(hashAndTag & ZSTD_SHORT_CACHE_TAG_MASK); | 1490 | 290M | assert(index >> (32 - ZSTD_SHORT_CACHE_TAG_BITS) == 0); | 1491 | 290M | hashTable[hash] = (index << ZSTD_SHORT_CACHE_TAG_BITS) | tag; | 1492 | 290M | } |
zstd_fast.c:ZSTD_writeTaggedIndex Line | Count | Source | 1487 | 55.6M | MEM_STATIC void ZSTD_writeTaggedIndex(U32* const hashTable, size_t hashAndTag, U32 index) { | 1488 | 55.6M | size_t const hash = hashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS; | 1489 | 55.6M | U32 const tag = (U32)(hashAndTag & ZSTD_SHORT_CACHE_TAG_MASK); | 1490 | 55.6M | assert(index >> (32 - ZSTD_SHORT_CACHE_TAG_BITS) == 0); | 1491 | 55.6M | hashTable[hash] = (index << ZSTD_SHORT_CACHE_TAG_BITS) | tag; | 1492 | 55.6M | } |
Unexecuted instantiation: zstd_lazy.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_ldm.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstd_opt.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zstdmt_compress.c:ZSTD_writeTaggedIndex Unexecuted instantiation: fastcover.c:ZSTD_writeTaggedIndex Unexecuted instantiation: zdict.c:ZSTD_writeTaggedIndex |
1493 | | |
1494 | | /* Helper function for short cache matchfinders. |
1495 | | * Unpacks tag1 and tag2 from lower bits of packedTag1 and packedTag2, then checks if the tags match. */ |
1496 | 87.7M | MEM_STATIC int ZSTD_comparePackedTags(size_t packedTag1, size_t packedTag2) { |
1497 | 87.7M | U32 const tag1 = packedTag1 & ZSTD_SHORT_CACHE_TAG_MASK; |
1498 | 87.7M | U32 const tag2 = packedTag2 & ZSTD_SHORT_CACHE_TAG_MASK; |
1499 | 87.7M | return tag1 == tag2; |
1500 | 87.7M | } Unexecuted instantiation: sequence_producer.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_compress.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_compress_literals.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_comparePackedTags zstd_double_fast.c:ZSTD_comparePackedTags Line | Count | Source | 1496 | 9.39M | MEM_STATIC int ZSTD_comparePackedTags(size_t packedTag1, size_t packedTag2) { | 1497 | 9.39M | U32 const tag1 = packedTag1 & ZSTD_SHORT_CACHE_TAG_MASK; | 1498 | 9.39M | U32 const tag2 = packedTag2 & ZSTD_SHORT_CACHE_TAG_MASK; | 1499 | 9.39M | return tag1 == tag2; | 1500 | 9.39M | } |
zstd_fast.c:ZSTD_comparePackedTags Line | Count | Source | 1496 | 78.3M | MEM_STATIC int ZSTD_comparePackedTags(size_t packedTag1, size_t packedTag2) { | 1497 | 78.3M | U32 const tag1 = packedTag1 & ZSTD_SHORT_CACHE_TAG_MASK; | 1498 | 78.3M | U32 const tag2 = packedTag2 & ZSTD_SHORT_CACHE_TAG_MASK; | 1499 | 78.3M | return tag1 == tag2; | 1500 | 78.3M | } |
Unexecuted instantiation: zstd_lazy.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_ldm.c:ZSTD_comparePackedTags Unexecuted instantiation: zstd_opt.c:ZSTD_comparePackedTags Unexecuted instantiation: zstdmt_compress.c:ZSTD_comparePackedTags Unexecuted instantiation: fastcover.c:ZSTD_comparePackedTags Unexecuted instantiation: zdict.c:ZSTD_comparePackedTags |
1501 | | |
1502 | | /* =============================================================== |
1503 | | * Shared internal declarations |
1504 | | * These prototypes may be called from sources not in lib/compress |
1505 | | * =============================================================== */ |
1506 | | |
1507 | | /* ZSTD_loadCEntropy() : |
1508 | | * dict : must point at beginning of a valid zstd dictionary. |
1509 | | * return : size of dictionary header (size of magic number + dict ID + entropy tables) |
1510 | | * assumptions : magic number supposed already checked |
1511 | | * and dictSize >= 8 */ |
1512 | | size_t ZSTD_loadCEntropy(ZSTD_compressedBlockState_t* bs, void* workspace, |
1513 | | const void* const dict, size_t dictSize); |
1514 | | |
1515 | | void ZSTD_reset_compressedBlockState(ZSTD_compressedBlockState_t* bs); |
1516 | | |
1517 | | typedef struct { |
1518 | | U32 idx; /* Index in array of ZSTD_Sequence */ |
1519 | | U32 posInSequence; /* Position within sequence at idx */ |
1520 | | size_t posInSrc; /* Number of bytes given by sequences provided so far */ |
1521 | | } ZSTD_SequencePosition; |
1522 | | |
1523 | | /* for benchmark */ |
1524 | | size_t ZSTD_convertBlockSequences(ZSTD_CCtx* cctx, |
1525 | | const ZSTD_Sequence* const inSeqs, size_t nbSequences, |
1526 | | int repcodeResolution); |
1527 | | |
1528 | | typedef struct { |
1529 | | size_t nbSequences; |
1530 | | size_t blockSize; |
1531 | | size_t litSize; |
1532 | | } BlockSummary; |
1533 | | |
1534 | | BlockSummary ZSTD_get1BlockSummary(const ZSTD_Sequence* seqs, size_t nbSeqs); |
1535 | | |
1536 | | /* ============================================================== |
1537 | | * Private declarations |
1538 | | * These prototypes shall only be called from within lib/compress |
1539 | | * ============================================================== */ |
1540 | | |
1541 | | /* ZSTD_getCParamsFromCCtxParams() : |
1542 | | * cParams are built depending on compressionLevel, src size hints, |
1543 | | * LDM and manually set compression parameters. |
1544 | | * Note: srcSizeHint == 0 means 0! |
1545 | | */ |
1546 | | ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( |
1547 | | const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize, ZSTD_CParamMode_e mode); |
1548 | | |
1549 | | /*! ZSTD_initCStream_internal() : |
1550 | | * Private use only. Init streaming operation. |
1551 | | * expects params to be valid. |
1552 | | * must receive dict, or cdict, or none, but not both. |
1553 | | * @return : 0, or an error code */ |
1554 | | size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs, |
1555 | | const void* dict, size_t dictSize, |
1556 | | const ZSTD_CDict* cdict, |
1557 | | const ZSTD_CCtx_params* params, unsigned long long pledgedSrcSize); |
1558 | | |
1559 | | void ZSTD_resetSeqStore(SeqStore_t* ssPtr); |
1560 | | |
1561 | | /*! ZSTD_getCParamsFromCDict() : |
1562 | | * as the name implies */ |
1563 | | ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict); |
1564 | | |
1565 | | /* ZSTD_compressBegin_advanced_internal() : |
1566 | | * Private use only. To be called from zstdmt_compress.c. */ |
1567 | | size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx, |
1568 | | const void* dict, size_t dictSize, |
1569 | | ZSTD_dictContentType_e dictContentType, |
1570 | | ZSTD_dictTableLoadMethod_e dtlm, |
1571 | | const ZSTD_CDict* cdict, |
1572 | | const ZSTD_CCtx_params* params, |
1573 | | unsigned long long pledgedSrcSize); |
1574 | | |
1575 | | /* ZSTD_compress_advanced_internal() : |
1576 | | * Private use only. To be called from zstdmt_compress.c. */ |
1577 | | size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx, |
1578 | | void* dst, size_t dstCapacity, |
1579 | | const void* src, size_t srcSize, |
1580 | | const void* dict,size_t dictSize, |
1581 | | const ZSTD_CCtx_params* params); |
1582 | | |
1583 | | |
1584 | | /* ZSTD_writeLastEmptyBlock() : |
1585 | | * output an empty Block with end-of-frame mark to complete a frame |
1586 | | * @return : size of data written into `dst` (== ZSTD_blockHeaderSize (defined in zstd_internal.h)) |
1587 | | * or an error code if `dstCapacity` is too small (<ZSTD_blockHeaderSize) |
1588 | | */ |
1589 | | size_t ZSTD_writeLastEmptyBlock(void* dst, size_t dstCapacity); |
1590 | | |
1591 | | |
1592 | | /* ZSTD_referenceExternalSequences() : |
1593 | | * Must be called before starting a compression operation. |
1594 | | * seqs must parse a prefix of the source. |
1595 | | * This cannot be used when long range matching is enabled. |
1596 | | * Zstd will use these sequences, and pass the literals to a secondary block |
1597 | | * compressor. |
1598 | | * NOTE: seqs are not verified! Invalid sequences can cause out-of-bounds memory |
1599 | | * access and data corruption. |
1600 | | */ |
1601 | | void ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq); |
1602 | | |
1603 | | /** ZSTD_cycleLog() : |
1604 | | * condition for correct operation : hashLog > 1 */ |
1605 | | U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat); |
1606 | | |
1607 | | /** ZSTD_CCtx_trace() : |
1608 | | * Trace the end of a compression call. |
1609 | | */ |
1610 | | void ZSTD_CCtx_trace(ZSTD_CCtx* cctx, size_t extraCSize); |
1611 | | |
1612 | | /* Returns 1 if an external sequence producer is registered, otherwise returns 0. */ |
1613 | 31.6M | MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) { |
1614 | 31.6M | return params->extSeqProdFunc != NULL; |
1615 | 31.6M | } Unexecuted instantiation: sequence_producer.c:ZSTD_hasExtSeqProd zstd_compress.c:ZSTD_hasExtSeqProd Line | Count | Source | 1613 | 31.6M | MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) { | 1614 | 31.6M | return params->extSeqProdFunc != NULL; | 1615 | 31.6M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_double_fast.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_fast.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_lazy.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_ldm.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstd_opt.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zstdmt_compress.c:ZSTD_hasExtSeqProd Unexecuted instantiation: fastcover.c:ZSTD_hasExtSeqProd Unexecuted instantiation: zdict.c:ZSTD_hasExtSeqProd |
1616 | | |
1617 | | /* =============================================================== |
1618 | | * Deprecated definitions that are still used internally to avoid |
1619 | | * deprecation warnings. These functions are exactly equivalent to |
1620 | | * their public variants, but avoid the deprecation warnings. |
1621 | | * =============================================================== */ |
1622 | | |
1623 | | size_t ZSTD_compressBegin_usingCDict_deprecated(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); |
1624 | | |
1625 | | size_t ZSTD_compressContinue_public(ZSTD_CCtx* cctx, |
1626 | | void* dst, size_t dstCapacity, |
1627 | | const void* src, size_t srcSize); |
1628 | | |
1629 | | size_t ZSTD_compressEnd_public(ZSTD_CCtx* cctx, |
1630 | | void* dst, size_t dstCapacity, |
1631 | | const void* src, size_t srcSize); |
1632 | | |
1633 | | size_t ZSTD_compressBlock_deprecated(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); |
1634 | | |
1635 | | |
1636 | | #endif /* ZSTD_COMPRESS_H */ |