fixed update of nextToUpdate

This commit is contained in:
inikep
2016-03-07 16:14:58 +01:00
parent e2446b0e36
commit 4f7f79ef9d
+5 -4
View File
@@ -250,8 +250,8 @@ static U32 ZSTD_insertBtAndGetAllMatches (
matches[mnum].off = current - matchIndex3; matches[mnum].off = current - matchIndex3;
matches[mnum].len = (U32)currentMl; matches[mnum].len = (U32)currentMl;
mnum++; mnum++;
if (currentMl > ZSTD_OPT_NUM) return mnum; if (currentMl > ZSTD_OPT_NUM) goto update;
if (ip+currentMl == iLimit) return mnum; /* best possible, and avoid read overflow*/ if (ip+currentMl == iLimit) goto update; /* best possible, and avoid read overflow*/
} }
} }
} }
@@ -316,6 +316,7 @@ static U32 ZSTD_insertBtAndGetAllMatches (
*smallerPtr = *largerPtr = 0; *smallerPtr = *largerPtr = 0;
update:
zc->nextToUpdate = (matchEndIdx > current + 8) ? matchEndIdx - 8 : current+1; zc->nextToUpdate = (matchEndIdx > current + 8) ? matchEndIdx - 8 : current+1;
return mnum; return mnum;
} }
@@ -340,8 +341,8 @@ static U32 ZSTD_BtGetAllMatches_selectMLS (
{ {
switch(matchLengthSearch) switch(matchLengthSearch)
{ {
default :
case 3 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 3, matches); case 3 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 3, matches);
default :
case 4 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 4, matches); case 4 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 4, matches);
case 5 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 5, matches); case 5 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 5, matches);
case 6 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 6, matches); case 6 : return ZSTD_BtGetAllMatches(zc, ip, iHighLimit, maxNbAttempts, 6, matches);
@@ -367,8 +368,8 @@ static U32 ZSTD_BtGetAllMatches_selectMLS_extDict (
{ {
switch(matchLengthSearch) switch(matchLengthSearch)
{ {
default :
case 3 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 3, matches); case 3 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 3, matches);
default :
case 4 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 4, matches); case 4 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 4, matches);
case 5 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 5, matches); case 5 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 5, matches);
case 6 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 6, matches); case 6 : return ZSTD_BtGetAllMatches_extDict(zc, ip, iHighLimit, maxNbAttempts, 6, matches);