File tree Expand file tree Collapse file tree 5 files changed +328
-316
lines changed
Expand file tree Collapse file tree 5 files changed +328
-316
lines changed Original file line number Diff line number Diff line change 33 push :
44 branches :
55 - dev
6+ pull_request :
7+ branches :
8+ - dev
9+
610permissions : read-all
11+
712jobs :
813 short-tests-0 :
914 runs-on : ubuntu-latest
2732 make -j regressiontest; make clean
2833 make shortest; make clean
2934 make cxxtest; make clean
35+
3036 short-tests-1 :
3137 runs-on : ubuntu-latest
3238 services :
4955 make aarch64build V=1; make clean
5056 make -C tests test-legacy test-longmatch; make clean
5157 make -C lib libzstd-nomt; make clean
58+
5259 regression-test :
5360 runs-on : ubuntu-latest
5461 services :
Original file line number Diff line number Diff line change @@ -252,21 +252,23 @@ size_t ZSTD_compressBlock_doubleFast_noDict_generic(
252252
253253_search_next_long :
254254
255- /* check prefix long +1 match */
256- if (idxl1 > prefixLowestIndex ) {
257- if (MEM_read64 (matchl1 ) == MEM_read64 (ip1 )) {
255+ /* short match found: let's check for a longer one */
256+ mLength = ZSTD_count (ip + 4 , matchs0 + 4 , iend ) + 4 ;
257+ offset = (U32 )(ip - matchs0 );
258+
259+ /* check long match at +1 position */
260+ if ((idxl1 > prefixLowestIndex ) && (MEM_read64 (matchl1 ) == MEM_read64 (ip1 ))) {
261+ size_t const l1len = ZSTD_count (ip1 + 8 , matchl1 + 8 , iend ) + 8 ;
262+ if (l1len > mLength ) {
263+ /* use the long match instead */
258264 ip = ip1 ;
259- mLength = ZSTD_count ( ip + 8 , matchl1 + 8 , iend ) + 8 ;
265+ mLength = l1len ;
260266 offset = (U32 )(ip - matchl1 );
261- while (((ip > anchor ) & (matchl1 > prefixLowest )) && (ip [-1 ] == matchl1 [-1 ])) { ip -- ; matchl1 -- ; mLength ++ ; } /* catch up */
262- goto _match_found ;
267+ matchs0 = matchl1 ;
263268 }
264269 }
265270
266- /* if no long +1 match, explore the short match we found */
267- mLength = ZSTD_count (ip + 4 , matchs0 + 4 , iend ) + 4 ;
268- offset = (U32 )(ip - matchs0 );
269- while (((ip > anchor ) & (matchs0 > prefixLowest )) && (ip [-1 ] == matchs0 [-1 ])) { ip -- ; matchs0 -- ; mLength ++ ; } /* catch up */
271+ while (((ip > anchor ) & (matchs0 > prefixLowest )) && (ip [-1 ] == matchs0 [-1 ])) { ip -- ; matchs0 -- ; mLength ++ ; } /* complete backward */
270272
271273 /* fall-through */
272274
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ fuzz-*.log
2323rt_lib_ *
2424d_lib_ *
2525crash- *
26+ decompress_cross_format
27+ generate_sequences
2628
2729# misc
2830trace
You can’t perform that action at this time.
0 commit comments