zstd-ruby 1.4.5.0 → 1.5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +35 -0
- data/README.md +2 -2
- data/ext/zstdruby/extconf.rb +2 -1
- data/ext/zstdruby/libzstd/BUCK +5 -7
- data/ext/zstdruby/libzstd/Makefile +225 -222
- data/ext/zstdruby/libzstd/README.md +43 -5
- data/ext/zstdruby/libzstd/common/bitstream.h +46 -22
- data/ext/zstdruby/libzstd/common/compiler.h +182 -22
- data/ext/zstdruby/libzstd/common/cpu.h +1 -3
- data/ext/zstdruby/libzstd/common/debug.c +1 -1
- data/ext/zstdruby/libzstd/common/debug.h +12 -19
- data/ext/zstdruby/libzstd/common/entropy_common.c +196 -44
- data/ext/zstdruby/libzstd/common/error_private.c +2 -1
- data/ext/zstdruby/libzstd/common/error_private.h +82 -3
- data/ext/zstdruby/libzstd/common/fse.h +41 -12
- data/ext/zstdruby/libzstd/common/fse_decompress.c +139 -22
- data/ext/zstdruby/libzstd/common/huf.h +47 -23
- data/ext/zstdruby/libzstd/common/mem.h +87 -98
- data/ext/zstdruby/libzstd/common/pool.c +23 -17
- data/ext/zstdruby/libzstd/common/pool.h +2 -2
- data/ext/zstdruby/libzstd/common/portability_macros.h +131 -0
- data/ext/zstdruby/libzstd/common/threading.c +6 -5
- data/ext/zstdruby/libzstd/common/xxhash.c +6 -846
- data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
- data/ext/zstdruby/libzstd/common/zstd_common.c +10 -10
- data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +189 -142
- data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
- data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +89 -46
- data/ext/zstdruby/libzstd/compress/hist.c +27 -29
- data/ext/zstdruby/libzstd/compress/hist.h +2 -2
- data/ext/zstdruby/libzstd/compress/huf_compress.c +770 -198
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +2894 -863
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +390 -90
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +12 -11
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +4 -2
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +31 -8
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +25 -297
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +206 -69
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +307 -132
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +322 -143
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1136 -174
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +59 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +316 -213
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +9 -2
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +373 -150
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +152 -444
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +31 -113
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1044 -403
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +571 -0
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +9 -9
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +450 -105
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +913 -273
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +14 -5
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +59 -12
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +24 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +55 -38
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +7 -6
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +43 -34
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +128 -58
- data/ext/zstdruby/libzstd/dll/example/Makefile +1 -1
- data/ext/zstdruby/libzstd/dll/example/README.md +16 -22
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +8 -8
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +9 -9
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +9 -9
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +10 -10
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/libzstd.mk +185 -0
- data/ext/zstdruby/libzstd/libzstd.pc.in +4 -3
- data/ext/zstdruby/libzstd/modulemap/module.modulemap +4 -0
- data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +154 -7
- data/ext/zstdruby/libzstd/zstd.h +699 -214
- data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +2 -1
- data/ext/zstdruby/zstdruby.c +2 -2
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +15 -6
- data/.travis.yml +0 -14
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -31,15 +31,15 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
|
|
31
31
|
* is empty.
|
32
32
|
*/
|
33
33
|
for (; ip + fastHashFillStep - 1 <= iend; ip += fastHashFillStep) {
|
34
|
-
U32 const
|
34
|
+
U32 const curr = (U32)(ip - base);
|
35
35
|
U32 i;
|
36
36
|
for (i = 0; i < fastHashFillStep; ++i) {
|
37
37
|
size_t const smHash = ZSTD_hashPtr(ip + i, hBitsS, mls);
|
38
38
|
size_t const lgHash = ZSTD_hashPtr(ip + i, hBitsL, 8);
|
39
39
|
if (i == 0)
|
40
|
-
hashSmall[smHash] =
|
40
|
+
hashSmall[smHash] = curr + i;
|
41
41
|
if (i == 0 || hashLarge[lgHash] == 0)
|
42
|
-
hashLarge[lgHash] =
|
42
|
+
hashLarge[lgHash] = curr + i;
|
43
43
|
/* Only load extra positions for ZSTD_dtlm_full */
|
44
44
|
if (dtlm == ZSTD_dtlm_fast)
|
45
45
|
break;
|
@@ -48,10 +48,9 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
|
|
48
48
|
|
49
49
|
|
50
50
|
FORCE_INLINE_TEMPLATE
|
51
|
-
size_t
|
51
|
+
size_t ZSTD_compressBlock_doubleFast_noDict_generic(
|
52
52
|
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
53
|
-
void const* src, size_t srcSize,
|
54
|
-
U32 const mls /* template */, ZSTD_dictMode_e const dictMode)
|
53
|
+
void const* src, size_t srcSize, U32 const mls /* template */)
|
55
54
|
{
|
56
55
|
ZSTD_compressionParameters const* cParams = &ms->cParams;
|
57
56
|
U32* const hashLong = ms->hashTable;
|
@@ -60,7 +59,6 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
60
59
|
const U32 hBitsS = cParams->chainLog;
|
61
60
|
const BYTE* const base = ms->window.base;
|
62
61
|
const BYTE* const istart = (const BYTE*)src;
|
63
|
-
const BYTE* ip = istart;
|
64
62
|
const BYTE* anchor = istart;
|
65
63
|
const U32 endIndex = (U32)((size_t)(istart - base) + srcSize);
|
66
64
|
/* presumes that, if there is a dictionary, it must be using Attach mode */
|
@@ -71,55 +69,239 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
71
69
|
U32 offset_1=rep[0], offset_2=rep[1];
|
72
70
|
U32 offsetSaved = 0;
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
&dms->cParams : NULL;
|
78
|
-
const U32* const dictHashLong = dictMode == ZSTD_dictMatchState ?
|
79
|
-
dms->hashTable : NULL;
|
80
|
-
const U32* const dictHashSmall = dictMode == ZSTD_dictMatchState ?
|
81
|
-
dms->chainTable : NULL;
|
82
|
-
const U32 dictStartIndex = dictMode == ZSTD_dictMatchState ?
|
83
|
-
dms->window.dictLimit : 0;
|
84
|
-
const BYTE* const dictBase = dictMode == ZSTD_dictMatchState ?
|
85
|
-
dms->window.base : NULL;
|
86
|
-
const BYTE* const dictStart = dictMode == ZSTD_dictMatchState ?
|
87
|
-
dictBase + dictStartIndex : NULL;
|
88
|
-
const BYTE* const dictEnd = dictMode == ZSTD_dictMatchState ?
|
89
|
-
dms->window.nextSrc : NULL;
|
90
|
-
const U32 dictIndexDelta = dictMode == ZSTD_dictMatchState ?
|
91
|
-
prefixLowestIndex - (U32)(dictEnd - dictBase) :
|
92
|
-
0;
|
93
|
-
const U32 dictHBitsL = dictMode == ZSTD_dictMatchState ?
|
94
|
-
dictCParams->hashLog : hBitsL;
|
95
|
-
const U32 dictHBitsS = dictMode == ZSTD_dictMatchState ?
|
96
|
-
dictCParams->chainLog : hBitsS;
|
97
|
-
const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictStart));
|
72
|
+
size_t mLength;
|
73
|
+
U32 offset;
|
74
|
+
U32 curr;
|
98
75
|
|
99
|
-
|
76
|
+
/* how many positions to search before increasing step size */
|
77
|
+
const size_t kStepIncr = 1 << kSearchStrength;
|
78
|
+
/* the position at which to increment the step size if no match is found */
|
79
|
+
const BYTE* nextStep;
|
80
|
+
size_t step; /* the current step size */
|
100
81
|
|
101
|
-
|
82
|
+
size_t hl0; /* the long hash at ip */
|
83
|
+
size_t hl1; /* the long hash at ip1 */
|
102
84
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
85
|
+
U32 idxl0; /* the long match index for ip */
|
86
|
+
U32 idxl1; /* the long match index for ip1 */
|
87
|
+
|
88
|
+
const BYTE* matchl0; /* the long match for ip */
|
89
|
+
const BYTE* matchs0; /* the short match for ip */
|
90
|
+
const BYTE* matchl1; /* the long match for ip1 */
|
91
|
+
|
92
|
+
const BYTE* ip = istart; /* the current position */
|
93
|
+
const BYTE* ip1; /* the next position */
|
94
|
+
|
95
|
+
DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_noDict_generic");
|
107
96
|
|
108
97
|
/* init */
|
109
|
-
ip += (
|
110
|
-
|
98
|
+
ip += ((ip - prefixLowest) == 0);
|
99
|
+
{
|
111
100
|
U32 const current = (U32)(ip - base);
|
112
101
|
U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, current, cParams->windowLog);
|
113
102
|
U32 const maxRep = current - windowLow;
|
114
103
|
if (offset_2 > maxRep) offsetSaved = offset_2, offset_2 = 0;
|
115
104
|
if (offset_1 > maxRep) offsetSaved = offset_1, offset_1 = 0;
|
116
105
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
106
|
+
|
107
|
+
/* Outer Loop: one iteration per match found and stored */
|
108
|
+
while (1) {
|
109
|
+
step = 1;
|
110
|
+
nextStep = ip + kStepIncr;
|
111
|
+
ip1 = ip + step;
|
112
|
+
|
113
|
+
if (ip1 > ilimit) {
|
114
|
+
goto _cleanup;
|
115
|
+
}
|
116
|
+
|
117
|
+
hl0 = ZSTD_hashPtr(ip, hBitsL, 8);
|
118
|
+
idxl0 = hashLong[hl0];
|
119
|
+
matchl0 = base + idxl0;
|
120
|
+
|
121
|
+
/* Inner Loop: one iteration per search / position */
|
122
|
+
do {
|
123
|
+
const size_t hs0 = ZSTD_hashPtr(ip, hBitsS, mls);
|
124
|
+
const U32 idxs0 = hashSmall[hs0];
|
125
|
+
curr = (U32)(ip-base);
|
126
|
+
matchs0 = base + idxs0;
|
127
|
+
|
128
|
+
hashLong[hl0] = hashSmall[hs0] = curr; /* update hash tables */
|
129
|
+
|
130
|
+
/* check noDict repcode */
|
131
|
+
if ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1))) {
|
132
|
+
mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
|
133
|
+
ip++;
|
134
|
+
ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH);
|
135
|
+
goto _match_stored;
|
136
|
+
}
|
137
|
+
|
138
|
+
hl1 = ZSTD_hashPtr(ip1, hBitsL, 8);
|
139
|
+
|
140
|
+
if (idxl0 > prefixLowestIndex) {
|
141
|
+
/* check prefix long match */
|
142
|
+
if (MEM_read64(matchl0) == MEM_read64(ip)) {
|
143
|
+
mLength = ZSTD_count(ip+8, matchl0+8, iend) + 8;
|
144
|
+
offset = (U32)(ip-matchl0);
|
145
|
+
while (((ip>anchor) & (matchl0>prefixLowest)) && (ip[-1] == matchl0[-1])) { ip--; matchl0--; mLength++; } /* catch up */
|
146
|
+
goto _match_found;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
idxl1 = hashLong[hl1];
|
151
|
+
matchl1 = base + idxl1;
|
152
|
+
|
153
|
+
if (idxs0 > prefixLowestIndex) {
|
154
|
+
/* check prefix short match */
|
155
|
+
if (MEM_read32(matchs0) == MEM_read32(ip)) {
|
156
|
+
goto _search_next_long;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
if (ip1 >= nextStep) {
|
161
|
+
PREFETCH_L1(ip1 + 64);
|
162
|
+
PREFETCH_L1(ip1 + 128);
|
163
|
+
step++;
|
164
|
+
nextStep += kStepIncr;
|
165
|
+
}
|
166
|
+
ip = ip1;
|
167
|
+
ip1 += step;
|
168
|
+
|
169
|
+
hl0 = hl1;
|
170
|
+
idxl0 = idxl1;
|
171
|
+
matchl0 = matchl1;
|
172
|
+
#if defined(__aarch64__)
|
173
|
+
PREFETCH_L1(ip+256);
|
174
|
+
#endif
|
175
|
+
} while (ip1 <= ilimit);
|
176
|
+
|
177
|
+
_cleanup:
|
178
|
+
/* save reps for next block */
|
179
|
+
rep[0] = offset_1 ? offset_1 : offsetSaved;
|
180
|
+
rep[1] = offset_2 ? offset_2 : offsetSaved;
|
181
|
+
|
182
|
+
/* Return the last literals size */
|
183
|
+
return (size_t)(iend - anchor);
|
184
|
+
|
185
|
+
_search_next_long:
|
186
|
+
|
187
|
+
/* check prefix long +1 match */
|
188
|
+
if (idxl1 > prefixLowestIndex) {
|
189
|
+
if (MEM_read64(matchl1) == MEM_read64(ip1)) {
|
190
|
+
ip = ip1;
|
191
|
+
mLength = ZSTD_count(ip+8, matchl1+8, iend) + 8;
|
192
|
+
offset = (U32)(ip-matchl1);
|
193
|
+
while (((ip>anchor) & (matchl1>prefixLowest)) && (ip[-1] == matchl1[-1])) { ip--; matchl1--; mLength++; } /* catch up */
|
194
|
+
goto _match_found;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
/* if no long +1 match, explore the short match we found */
|
199
|
+
mLength = ZSTD_count(ip+4, matchs0+4, iend) + 4;
|
200
|
+
offset = (U32)(ip - matchs0);
|
201
|
+
while (((ip>anchor) & (matchs0>prefixLowest)) && (ip[-1] == matchs0[-1])) { ip--; matchs0--; mLength++; } /* catch up */
|
202
|
+
|
203
|
+
/* fall-through */
|
204
|
+
|
205
|
+
_match_found: /* requires ip, offset, mLength */
|
206
|
+
offset_2 = offset_1;
|
207
|
+
offset_1 = offset;
|
208
|
+
|
209
|
+
if (step < 4) {
|
210
|
+
/* It is unsafe to write this value back to the hashtable when ip1 is
|
211
|
+
* greater than or equal to the new ip we will have after we're done
|
212
|
+
* processing this match. Rather than perform that test directly
|
213
|
+
* (ip1 >= ip + mLength), which costs speed in practice, we do a simpler
|
214
|
+
* more predictable test. The minmatch even if we take a short match is
|
215
|
+
* 4 bytes, so as long as step, the distance between ip and ip1
|
216
|
+
* (initially) is less than 4, we know ip1 < new ip. */
|
217
|
+
hashLong[hl1] = (U32)(ip1 - base);
|
218
|
+
}
|
219
|
+
|
220
|
+
ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
|
221
|
+
|
222
|
+
_match_stored:
|
223
|
+
/* match found */
|
224
|
+
ip += mLength;
|
225
|
+
anchor = ip;
|
226
|
+
|
227
|
+
if (ip <= ilimit) {
|
228
|
+
/* Complementary insertion */
|
229
|
+
/* done after iLimit test, as candidates could be > iend-8 */
|
230
|
+
{ U32 const indexToInsert = curr+2;
|
231
|
+
hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert;
|
232
|
+
hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base);
|
233
|
+
hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert;
|
234
|
+
hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base);
|
235
|
+
}
|
236
|
+
|
237
|
+
/* check immediate repcode */
|
238
|
+
while ( (ip <= ilimit)
|
239
|
+
&& ( (offset_2>0)
|
240
|
+
& (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) {
|
241
|
+
/* store sequence */
|
242
|
+
size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
|
243
|
+
U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; /* swap offset_2 <=> offset_1 */
|
244
|
+
hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base);
|
245
|
+
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base);
|
246
|
+
ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, rLength-MINMATCH);
|
247
|
+
ip += rLength;
|
248
|
+
anchor = ip;
|
249
|
+
continue; /* faster when present ... (?) */
|
250
|
+
}
|
251
|
+
}
|
122
252
|
}
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
FORCE_INLINE_TEMPLATE
|
257
|
+
size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic(
|
258
|
+
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
259
|
+
void const* src, size_t srcSize,
|
260
|
+
U32 const mls /* template */)
|
261
|
+
{
|
262
|
+
ZSTD_compressionParameters const* cParams = &ms->cParams;
|
263
|
+
U32* const hashLong = ms->hashTable;
|
264
|
+
const U32 hBitsL = cParams->hashLog;
|
265
|
+
U32* const hashSmall = ms->chainTable;
|
266
|
+
const U32 hBitsS = cParams->chainLog;
|
267
|
+
const BYTE* const base = ms->window.base;
|
268
|
+
const BYTE* const istart = (const BYTE*)src;
|
269
|
+
const BYTE* ip = istart;
|
270
|
+
const BYTE* anchor = istart;
|
271
|
+
const U32 endIndex = (U32)((size_t)(istart - base) + srcSize);
|
272
|
+
/* presumes that, if there is a dictionary, it must be using Attach mode */
|
273
|
+
const U32 prefixLowestIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog);
|
274
|
+
const BYTE* const prefixLowest = base + prefixLowestIndex;
|
275
|
+
const BYTE* const iend = istart + srcSize;
|
276
|
+
const BYTE* const ilimit = iend - HASH_READ_SIZE;
|
277
|
+
U32 offset_1=rep[0], offset_2=rep[1];
|
278
|
+
U32 offsetSaved = 0;
|
279
|
+
|
280
|
+
const ZSTD_matchState_t* const dms = ms->dictMatchState;
|
281
|
+
const ZSTD_compressionParameters* const dictCParams = &dms->cParams;
|
282
|
+
const U32* const dictHashLong = dms->hashTable;
|
283
|
+
const U32* const dictHashSmall = dms->chainTable;
|
284
|
+
const U32 dictStartIndex = dms->window.dictLimit;
|
285
|
+
const BYTE* const dictBase = dms->window.base;
|
286
|
+
const BYTE* const dictStart = dictBase + dictStartIndex;
|
287
|
+
const BYTE* const dictEnd = dms->window.nextSrc;
|
288
|
+
const U32 dictIndexDelta = prefixLowestIndex - (U32)(dictEnd - dictBase);
|
289
|
+
const U32 dictHBitsL = dictCParams->hashLog;
|
290
|
+
const U32 dictHBitsS = dictCParams->chainLog;
|
291
|
+
const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictStart));
|
292
|
+
|
293
|
+
DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_dictMatchState_generic");
|
294
|
+
|
295
|
+
/* if a dictionary is attached, it must be within window range */
|
296
|
+
assert(ms->window.dictLimit + (1U << cParams->windowLog) >= endIndex);
|
297
|
+
|
298
|
+
/* init */
|
299
|
+
ip += (dictAndPrefixLength == 0);
|
300
|
+
|
301
|
+
/* dictMatchState repCode checks don't currently handle repCode == 0
|
302
|
+
* disabling. */
|
303
|
+
assert(offset_1 <= dictAndPrefixLength);
|
304
|
+
assert(offset_2 <= dictAndPrefixLength);
|
123
305
|
|
124
306
|
/* Main Search Loop */
|
125
307
|
while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */
|
@@ -129,21 +311,19 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
129
311
|
size_t const h = ZSTD_hashPtr(ip, hBitsS, mls);
|
130
312
|
size_t const dictHL = ZSTD_hashPtr(ip, dictHBitsL, 8);
|
131
313
|
size_t const dictHS = ZSTD_hashPtr(ip, dictHBitsS, mls);
|
132
|
-
U32 const
|
314
|
+
U32 const curr = (U32)(ip-base);
|
133
315
|
U32 const matchIndexL = hashLong[h2];
|
134
316
|
U32 matchIndexS = hashSmall[h];
|
135
317
|
const BYTE* matchLong = base + matchIndexL;
|
136
318
|
const BYTE* match = base + matchIndexS;
|
137
|
-
const U32 repIndex =
|
138
|
-
const BYTE* repMatch = (
|
139
|
-
&& repIndex < prefixLowestIndex) ?
|
319
|
+
const U32 repIndex = curr + 1 - offset_1;
|
320
|
+
const BYTE* repMatch = (repIndex < prefixLowestIndex) ?
|
140
321
|
dictBase + (repIndex - dictIndexDelta) :
|
141
322
|
base + repIndex;
|
142
|
-
hashLong[h2] = hashSmall[h] =
|
323
|
+
hashLong[h2] = hashSmall[h] = curr; /* update hash tables */
|
143
324
|
|
144
|
-
/* check
|
145
|
-
if (
|
146
|
-
&& ((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */)
|
325
|
+
/* check repcode */
|
326
|
+
if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */)
|
147
327
|
&& (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
|
148
328
|
const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
|
149
329
|
mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
|
@@ -152,15 +332,6 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
152
332
|
goto _match_stored;
|
153
333
|
}
|
154
334
|
|
155
|
-
/* check noDict repcode */
|
156
|
-
if ( dictMode == ZSTD_noDict
|
157
|
-
&& ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) {
|
158
|
-
mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
|
159
|
-
ip++;
|
160
|
-
ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH);
|
161
|
-
goto _match_stored;
|
162
|
-
}
|
163
|
-
|
164
335
|
if (matchIndexL > prefixLowestIndex) {
|
165
336
|
/* check prefix long match */
|
166
337
|
if (MEM_read64(matchLong) == MEM_read64(ip)) {
|
@@ -169,7 +340,7 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
169
340
|
while (((ip>anchor) & (matchLong>prefixLowest)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */
|
170
341
|
goto _match_found;
|
171
342
|
}
|
172
|
-
} else
|
343
|
+
} else {
|
173
344
|
/* check dictMatchState long match */
|
174
345
|
U32 const dictMatchIndexL = dictHashLong[dictHL];
|
175
346
|
const BYTE* dictMatchL = dictBase + dictMatchIndexL;
|
@@ -177,7 +348,7 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
177
348
|
|
178
349
|
if (dictMatchL > dictStart && MEM_read64(dictMatchL) == MEM_read64(ip)) {
|
179
350
|
mLength = ZSTD_count_2segments(ip+8, dictMatchL+8, iend, dictEnd, prefixLowest) + 8;
|
180
|
-
offset = (U32)(
|
351
|
+
offset = (U32)(curr - dictMatchIndexL - dictIndexDelta);
|
181
352
|
while (((ip>anchor) & (dictMatchL>dictStart)) && (ip[-1] == dictMatchL[-1])) { ip--; dictMatchL--; mLength++; } /* catch up */
|
182
353
|
goto _match_found;
|
183
354
|
} }
|
@@ -187,7 +358,7 @@ size_t ZSTD_compressBlock_doubleFast_generic(
|
|
187
358
|
if (MEM_read32(match) == MEM_read32(ip)) {
|
188
359
|
goto _search_next_long;
|
189
360
|
}
|
190
|
-
} else
|
361
|
+
} else {
|
191
362
|
/* check dictMatchState short match */
|
192
363
|
U32 const dictMatchIndexS = dictHashSmall[dictHS];
|
193
364
|
match = dictBase + dictMatchIndexS;
|
@@ -209,7 +380,7 @@ _search_next_long:
|
|
209
380
|
size_t const dictHLNext = ZSTD_hashPtr(ip+1, dictHBitsL, 8);
|
210
381
|
U32 const matchIndexL3 = hashLong[hl3];
|
211
382
|
const BYTE* matchL3 = base + matchIndexL3;
|
212
|
-
hashLong[hl3] =
|
383
|
+
hashLong[hl3] = curr + 1;
|
213
384
|
|
214
385
|
/* check prefix long +1 match */
|
215
386
|
if (matchIndexL3 > prefixLowestIndex) {
|
@@ -220,7 +391,7 @@ _search_next_long:
|
|
220
391
|
while (((ip>anchor) & (matchL3>prefixLowest)) && (ip[-1] == matchL3[-1])) { ip--; matchL3--; mLength++; } /* catch up */
|
221
392
|
goto _match_found;
|
222
393
|
}
|
223
|
-
} else
|
394
|
+
} else {
|
224
395
|
/* check dict long +1 match */
|
225
396
|
U32 const dictMatchIndexL3 = dictHashLong[dictHLNext];
|
226
397
|
const BYTE* dictMatchL3 = dictBase + dictMatchIndexL3;
|
@@ -228,15 +399,15 @@ _search_next_long:
|
|
228
399
|
if (dictMatchL3 > dictStart && MEM_read64(dictMatchL3) == MEM_read64(ip+1)) {
|
229
400
|
mLength = ZSTD_count_2segments(ip+1+8, dictMatchL3+8, iend, dictEnd, prefixLowest) + 8;
|
230
401
|
ip++;
|
231
|
-
offset = (U32)(
|
402
|
+
offset = (U32)(curr + 1 - dictMatchIndexL3 - dictIndexDelta);
|
232
403
|
while (((ip>anchor) & (dictMatchL3>dictStart)) && (ip[-1] == dictMatchL3[-1])) { ip--; dictMatchL3--; mLength++; } /* catch up */
|
233
404
|
goto _match_found;
|
234
405
|
} } }
|
235
406
|
|
236
407
|
/* if no long +1 match, explore the short match we found */
|
237
|
-
if (
|
408
|
+
if (matchIndexS < prefixLowestIndex) {
|
238
409
|
mLength = ZSTD_count_2segments(ip+4, match+4, iend, dictEnd, prefixLowest) + 4;
|
239
|
-
offset = (U32)(
|
410
|
+
offset = (U32)(curr - matchIndexS);
|
240
411
|
while (((ip>anchor) & (match>dictStart)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
|
241
412
|
} else {
|
242
413
|
mLength = ZSTD_count(ip+4, match+4, iend) + 4;
|
@@ -244,8 +415,6 @@ _search_next_long:
|
|
244
415
|
while (((ip>anchor) & (match>prefixLowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
|
245
416
|
}
|
246
417
|
|
247
|
-
/* fall-through */
|
248
|
-
|
249
418
|
_match_found:
|
250
419
|
offset_2 = offset_1;
|
251
420
|
offset_1 = offset;
|
@@ -260,7 +429,7 @@ _match_stored:
|
|
260
429
|
if (ip <= ilimit) {
|
261
430
|
/* Complementary insertion */
|
262
431
|
/* done after iLimit test, as candidates could be > iend-8 */
|
263
|
-
{ U32 const indexToInsert =
|
432
|
+
{ U32 const indexToInsert = curr+2;
|
264
433
|
hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert;
|
265
434
|
hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base);
|
266
435
|
hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert;
|
@@ -268,43 +437,27 @@ _match_stored:
|
|
268
437
|
}
|
269
438
|
|
270
439
|
/* check immediate repcode */
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2;
|
287
|
-
ip += repLength2;
|
288
|
-
anchor = ip;
|
289
|
-
continue;
|
290
|
-
}
|
291
|
-
break;
|
292
|
-
} }
|
293
|
-
|
294
|
-
if (dictMode == ZSTD_noDict) {
|
295
|
-
while ( (ip <= ilimit)
|
296
|
-
&& ( (offset_2>0)
|
297
|
-
& (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) {
|
298
|
-
/* store sequence */
|
299
|
-
size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
|
300
|
-
U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; /* swap offset_2 <=> offset_1 */
|
301
|
-
hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base);
|
302
|
-
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base);
|
303
|
-
ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, rLength-MINMATCH);
|
304
|
-
ip += rLength;
|
440
|
+
while (ip <= ilimit) {
|
441
|
+
U32 const current2 = (U32)(ip-base);
|
442
|
+
U32 const repIndex2 = current2 - offset_2;
|
443
|
+
const BYTE* repMatch2 = repIndex2 < prefixLowestIndex ?
|
444
|
+
dictBase + repIndex2 - dictIndexDelta :
|
445
|
+
base + repIndex2;
|
446
|
+
if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */)
|
447
|
+
&& (MEM_read32(repMatch2) == MEM_read32(ip)) ) {
|
448
|
+
const BYTE* const repEnd2 = repIndex2 < prefixLowestIndex ? dictEnd : iend;
|
449
|
+
size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixLowest) + 4;
|
450
|
+
U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */
|
451
|
+
ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH);
|
452
|
+
hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2;
|
453
|
+
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2;
|
454
|
+
ip += repLength2;
|
305
455
|
anchor = ip;
|
306
|
-
continue;
|
307
|
-
|
456
|
+
continue;
|
457
|
+
}
|
458
|
+
break;
|
459
|
+
}
|
460
|
+
}
|
308
461
|
} /* while (ip < ilimit) */
|
309
462
|
|
310
463
|
/* save reps for next block */
|
@@ -315,6 +468,24 @@ _match_stored:
|
|
315
468
|
return (size_t)(iend - anchor);
|
316
469
|
}
|
317
470
|
|
471
|
+
#define ZSTD_GEN_DFAST_FN(dictMode, mls) \
|
472
|
+
static size_t ZSTD_compressBlock_doubleFast_##dictMode##_##mls( \
|
473
|
+
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], \
|
474
|
+
void const* src, size_t srcSize) \
|
475
|
+
{ \
|
476
|
+
return ZSTD_compressBlock_doubleFast_##dictMode##_generic(ms, seqStore, rep, src, srcSize, mls); \
|
477
|
+
}
|
478
|
+
|
479
|
+
ZSTD_GEN_DFAST_FN(noDict, 4)
|
480
|
+
ZSTD_GEN_DFAST_FN(noDict, 5)
|
481
|
+
ZSTD_GEN_DFAST_FN(noDict, 6)
|
482
|
+
ZSTD_GEN_DFAST_FN(noDict, 7)
|
483
|
+
|
484
|
+
ZSTD_GEN_DFAST_FN(dictMatchState, 4)
|
485
|
+
ZSTD_GEN_DFAST_FN(dictMatchState, 5)
|
486
|
+
ZSTD_GEN_DFAST_FN(dictMatchState, 6)
|
487
|
+
ZSTD_GEN_DFAST_FN(dictMatchState, 7)
|
488
|
+
|
318
489
|
|
319
490
|
size_t ZSTD_compressBlock_doubleFast(
|
320
491
|
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
@@ -325,13 +496,13 @@ size_t ZSTD_compressBlock_doubleFast(
|
|
325
496
|
{
|
326
497
|
default: /* includes case 3 */
|
327
498
|
case 4 :
|
328
|
-
return
|
499
|
+
return ZSTD_compressBlock_doubleFast_noDict_4(ms, seqStore, rep, src, srcSize);
|
329
500
|
case 5 :
|
330
|
-
return
|
501
|
+
return ZSTD_compressBlock_doubleFast_noDict_5(ms, seqStore, rep, src, srcSize);
|
331
502
|
case 6 :
|
332
|
-
return
|
503
|
+
return ZSTD_compressBlock_doubleFast_noDict_6(ms, seqStore, rep, src, srcSize);
|
333
504
|
case 7 :
|
334
|
-
return
|
505
|
+
return ZSTD_compressBlock_doubleFast_noDict_7(ms, seqStore, rep, src, srcSize);
|
335
506
|
}
|
336
507
|
}
|
337
508
|
|
@@ -345,13 +516,13 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState(
|
|
345
516
|
{
|
346
517
|
default: /* includes case 3 */
|
347
518
|
case 4 :
|
348
|
-
return
|
519
|
+
return ZSTD_compressBlock_doubleFast_dictMatchState_4(ms, seqStore, rep, src, srcSize);
|
349
520
|
case 5 :
|
350
|
-
return
|
521
|
+
return ZSTD_compressBlock_doubleFast_dictMatchState_5(ms, seqStore, rep, src, srcSize);
|
351
522
|
case 6 :
|
352
|
-
return
|
523
|
+
return ZSTD_compressBlock_doubleFast_dictMatchState_6(ms, seqStore, rep, src, srcSize);
|
353
524
|
case 7 :
|
354
|
-
return
|
525
|
+
return ZSTD_compressBlock_doubleFast_dictMatchState_7(ms, seqStore, rep, src, srcSize);
|
355
526
|
}
|
356
527
|
}
|
357
528
|
|
@@ -387,7 +558,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
387
558
|
|
388
559
|
/* if extDict is invalidated due to maxDistance, switch to "regular" variant */
|
389
560
|
if (prefixStartIndex == dictStartIndex)
|
390
|
-
return
|
561
|
+
return ZSTD_compressBlock_doubleFast(ms, seqStore, rep, src, srcSize);
|
391
562
|
|
392
563
|
/* Search Loop */
|
393
564
|
while (ip < ilimit) { /* < instead of <=, because (ip+1) */
|
@@ -401,15 +572,15 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
401
572
|
const BYTE* const matchLongBase = matchLongIndex < prefixStartIndex ? dictBase : base;
|
402
573
|
const BYTE* matchLong = matchLongBase + matchLongIndex;
|
403
574
|
|
404
|
-
const U32
|
405
|
-
const U32 repIndex =
|
575
|
+
const U32 curr = (U32)(ip-base);
|
576
|
+
const U32 repIndex = curr + 1 - offset_1; /* offset_1 expected <= curr +1 */
|
406
577
|
const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base;
|
407
578
|
const BYTE* const repMatch = repBase + repIndex;
|
408
579
|
size_t mLength;
|
409
|
-
hashSmall[hSmall] = hashLong[hLong] =
|
580
|
+
hashSmall[hSmall] = hashLong[hLong] = curr; /* update hash table */
|
410
581
|
|
411
582
|
if ((((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex doesn't overlap dict + prefix */
|
412
|
-
& (
|
583
|
+
& (offset_1 <= curr+1 - dictStartIndex)) /* note: we are searching at curr+1 */
|
413
584
|
&& (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
|
414
585
|
const BYTE* repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend;
|
415
586
|
mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4;
|
@@ -421,7 +592,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
421
592
|
const BYTE* const lowMatchPtr = matchLongIndex < prefixStartIndex ? dictStart : prefixStart;
|
422
593
|
U32 offset;
|
423
594
|
mLength = ZSTD_count_2segments(ip+8, matchLong+8, iend, matchEnd, prefixStart) + 8;
|
424
|
-
offset =
|
595
|
+
offset = curr - matchLongIndex;
|
425
596
|
while (((ip>anchor) & (matchLong>lowMatchPtr)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */
|
426
597
|
offset_2 = offset_1;
|
427
598
|
offset_1 = offset;
|
@@ -433,19 +604,19 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
433
604
|
const BYTE* const match3Base = matchIndex3 < prefixStartIndex ? dictBase : base;
|
434
605
|
const BYTE* match3 = match3Base + matchIndex3;
|
435
606
|
U32 offset;
|
436
|
-
hashLong[h3] =
|
607
|
+
hashLong[h3] = curr + 1;
|
437
608
|
if ( (matchIndex3 > dictStartIndex) && (MEM_read64(match3) == MEM_read64(ip+1)) ) {
|
438
609
|
const BYTE* const matchEnd = matchIndex3 < prefixStartIndex ? dictEnd : iend;
|
439
610
|
const BYTE* const lowMatchPtr = matchIndex3 < prefixStartIndex ? dictStart : prefixStart;
|
440
611
|
mLength = ZSTD_count_2segments(ip+9, match3+8, iend, matchEnd, prefixStart) + 8;
|
441
612
|
ip++;
|
442
|
-
offset =
|
613
|
+
offset = curr+1 - matchIndex3;
|
443
614
|
while (((ip>anchor) & (match3>lowMatchPtr)) && (ip[-1] == match3[-1])) { ip--; match3--; mLength++; } /* catch up */
|
444
615
|
} else {
|
445
616
|
const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend;
|
446
617
|
const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart;
|
447
618
|
mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4;
|
448
|
-
offset =
|
619
|
+
offset = curr - matchIndex;
|
449
620
|
while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
|
450
621
|
}
|
451
622
|
offset_2 = offset_1;
|
@@ -464,7 +635,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
464
635
|
if (ip <= ilimit) {
|
465
636
|
/* Complementary insertion */
|
466
637
|
/* done after iLimit test, as candidates could be > iend-8 */
|
467
|
-
{ U32 const indexToInsert =
|
638
|
+
{ U32 const indexToInsert = curr+2;
|
468
639
|
hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert;
|
469
640
|
hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base);
|
470
641
|
hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert;
|
@@ -477,7 +648,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
477
648
|
U32 const repIndex2 = current2 - offset_2;
|
478
649
|
const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2;
|
479
650
|
if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) /* intentional overflow : ensure repIndex2 doesn't overlap dict + prefix */
|
480
|
-
& (
|
651
|
+
& (offset_2 <= current2 - dictStartIndex))
|
481
652
|
&& (MEM_read32(repMatch2) == MEM_read32(ip)) ) {
|
482
653
|
const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend;
|
483
654
|
size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4;
|
@@ -500,6 +671,10 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
|
|
500
671
|
return (size_t)(iend - anchor);
|
501
672
|
}
|
502
673
|
|
674
|
+
ZSTD_GEN_DFAST_FN(extDict, 4)
|
675
|
+
ZSTD_GEN_DFAST_FN(extDict, 5)
|
676
|
+
ZSTD_GEN_DFAST_FN(extDict, 6)
|
677
|
+
ZSTD_GEN_DFAST_FN(extDict, 7)
|
503
678
|
|
504
679
|
size_t ZSTD_compressBlock_doubleFast_extDict(
|
505
680
|
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
|
@@ -510,12 +685,12 @@ size_t ZSTD_compressBlock_doubleFast_extDict(
|
|
510
685
|
{
|
511
686
|
default: /* includes case 3 */
|
512
687
|
case 4 :
|
513
|
-
return
|
688
|
+
return ZSTD_compressBlock_doubleFast_extDict_4(ms, seqStore, rep, src, srcSize);
|
514
689
|
case 5 :
|
515
|
-
return
|
690
|
+
return ZSTD_compressBlock_doubleFast_extDict_5(ms, seqStore, rep, src, srcSize);
|
516
691
|
case 6 :
|
517
|
-
return
|
692
|
+
return ZSTD_compressBlock_doubleFast_extDict_6(ms, seqStore, rep, src, srcSize);
|
518
693
|
case 7 :
|
519
|
-
return
|
694
|
+
return ZSTD_compressBlock_doubleFast_extDict_7(ms, seqStore, rep, src, srcSize);
|
520
695
|
}
|
521
696
|
}
|