From: inikep Date: Wed, 3 Feb 2016 12:17:28 +0000 (+0100) Subject: auto check of matches X-Git-Tag: v0.5.1^2~3^2~58^2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b8b1f9d539efa301227a6616f28db24f7951097;p=thirdparty%2Fzstd.git auto check of matches --- diff --git a/lib/zstd_opt.c b/lib/zstd_opt.c index 66d0dcdbf..4eb516578 100644 --- a/lib/zstd_opt.c +++ b/lib/zstd_opt.c @@ -764,11 +764,8 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx, { SET_PRICE(cur2 + mlen, mlen, matches[i].off, litlen, price); - // if (opt[cur2].litlen>0) - opt[cur2 + mlen].rep = matches[i].off; // update reps - // else - // opt[cur2 + mlen].rep = opt[cur2].off; - // if (cur2 < cur_min) cur_min = cur2; + opt[cur2 + mlen].rep = matches[i].off; // update reps + opt[cur2 + mlen].rep2 = opt[cur2].rep; } mlen++; @@ -878,8 +875,7 @@ _storeSequence: // cur, last_pos, best_mlen, best_off have to be set printf("%d: ERROR rep_1=%d rep_2=%d cur_rep=%d\n", (int)(ip - base), (int)rep_1, (int)rep_2, cur_rep); exit(0); } - - + if (offset) { rep_2 = rep_1; @@ -900,20 +896,17 @@ _storeSequence: // cur, last_pos, best_mlen, best_off have to be set // printf("match="); print_hex_text(ip-offset, mlen, 0); #if 1 -/* size_t ml2; + size_t ml2; if (offset) ml2 = ZSTD_count(ip, ip-offset, iend); else -// if (litLength>0) ml2 = ZSTD_count(ip, ip-rep_1, iend); - // else - // ml2 = ZSTD_count(ip, ip-rep_2, iend); + if (ml2 < mlen && ml2 < MINMATCH) { - printf("%d: ERROR iend=%d mlen=%d offset=%d rep=%d ml2=%d\n", (int)(ip - base), (int)(iend - ip), (int)mlen, (int)offset, (int)rep_1, (int)ml2); + printf("%d: ERROR iend=%d mlen=%d offset=%d cur_rep=%d ml2=%d\n", (int)(ip - base), (int)(iend - ip), (int)mlen, (int)offset, (int)cur_rep, (int)ml2); exit(0); } -*/ if (ip < anchor) {