Merge pull request #1405 from AtariDreams/loop
Define mlen = MINMATCH at the start of the loop
GitOrigin-RevId: c1501a248f3d11506f51c211c207ab086fbb8432
Change-Id: I1def93a027d4340bd432e390242c7efee25d36ab
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 4eb81dc..3a266fb 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -1811,11 +1811,11 @@
rPos, cost, opt[rPos].litlen);
} }
/* set prices using initial match */
- { int mlen = MINMATCH;
- int const matchML = firstMatch.len; /* necessarily < sufficient_len < LZ4_OPT_NUM */
+ { int const matchML = firstMatch.len; /* necessarily < sufficient_len < LZ4_OPT_NUM */
int const offset = firstMatch.off;
+ int mlen;
assert(matchML < LZ4_OPT_NUM);
- for ( ; mlen <= matchML ; mlen++) {
+ for (mlen = MINMATCH ; mlen <= matchML ; mlen++) {
int const cost = LZ4HC_sequencePrice(llen, mlen);
opt[mlen].mlen = mlen;
opt[mlen].off = offset;