minor simplification

dev
Yann Collet 2015-12-31 19:08:44 +01:00
parent 722504c2a0
commit 72e84cfd0f
1 changed files with 8 additions and 8 deletions

View File

@ -1034,7 +1034,7 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc, const BYTE* const ip, const U32 mls, co
U32* largerPtr = bt + 2*(current&btMask) + 1; U32* largerPtr = bt + 2*(current&btMask) + 1;
U32 dummy32; /* to be nullified at the end */ U32 dummy32; /* to be nullified at the end */
const U32 windowLow = zc->lowLimit; const U32 windowLow = zc->lowLimit;
U32 matchEndIdx = current; U32 matchEndIdx = current+8;
hashTable[h] = current; /* Update Hash Table */ hashTable[h] = current; /* Update Hash Table */
@ -1074,7 +1074,7 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc, const BYTE* const ip, const U32 mls, co
} }
*smallerPtr = *largerPtr = 0; *smallerPtr = *largerPtr = 0;
return (matchEndIdx > current + zc->params.searchLength) ? matchEndIdx - current - zc->params.searchLength : 1; return (matchEndIdx > current + 8) ? matchEndIdx - current - 8 : 1;
} }
@ -1100,7 +1100,7 @@ size_t ZSTD_insertBtAndFindBestMatch (
U32* smallerPtr = bt + 2*(current&btMask); U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1; U32* largerPtr = bt + 2*(current&btMask) + 1;
size_t bestLength = 0; size_t bestLength = 0;
U32 matchEndIdx = current; U32 matchEndIdx = current+8;
U32 dummy32; /* to be nullified at the end */ U32 dummy32; /* to be nullified at the end */
hashTable[h] = current; /* Update Hash Table */ hashTable[h] = current; /* Update Hash Table */
@ -1146,7 +1146,7 @@ size_t ZSTD_insertBtAndFindBestMatch (
*smallerPtr = *largerPtr = 0; *smallerPtr = *largerPtr = 0;
zc->nextToUpdate = (matchEndIdx > current + zc->params.searchLength) ? matchEndIdx - zc->params.searchLength : current+1; zc->nextToUpdate = (matchEndIdx > current + 8) ? matchEndIdx - 8 : current+1;
return bestLength; return bestLength;
} }
@ -1217,7 +1217,7 @@ static U32 ZSTD_insertBt1_extDict(ZSTD_CCtx* zc, const BYTE* const ip, const U32
U32* largerPtr = bt + 2*(current&btMask) + 1; U32* largerPtr = bt + 2*(current&btMask) + 1;
U32 dummy32; /* to be nullified at the end */ U32 dummy32; /* to be nullified at the end */
const U32 windowLow = zc->lowLimit; const U32 windowLow = zc->lowLimit;
U32 matchEndIdx = current; U32 matchEndIdx = current+8;
hashTable[h] = current; /* Update Hash Table */ hashTable[h] = current; /* Update Hash Table */
@ -1267,7 +1267,7 @@ static U32 ZSTD_insertBt1_extDict(ZSTD_CCtx* zc, const BYTE* const ip, const U32
} }
*smallerPtr = *largerPtr = 0; *smallerPtr = *largerPtr = 0;
return (matchEndIdx > current + zc->params.searchLength) ? matchEndIdx - current - zc->params.searchLength : 1; return (matchEndIdx > current + 8) ? matchEndIdx - current - 8 : 1;
} }
@ -1308,7 +1308,7 @@ size_t ZSTD_insertBtAndFindBestMatch_extDict (
U32* smallerPtr = bt + 2*(current&btMask); U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1; U32* largerPtr = bt + 2*(current&btMask) + 1;
size_t bestLength = 0; size_t bestLength = 0;
U32 matchEndIdx = current; U32 matchEndIdx = current+8;
U32 dummy32; /* to be nullified at the end */ U32 dummy32; /* to be nullified at the end */
hashTable[h] = current; /* Update Hash Table */ hashTable[h] = current; /* Update Hash Table */
@ -1365,7 +1365,7 @@ size_t ZSTD_insertBtAndFindBestMatch_extDict (
*smallerPtr = *largerPtr = 0; *smallerPtr = *largerPtr = 0;
zc->nextToUpdate = (matchEndIdx > current + zc->params.searchLength) ? matchEndIdx - zc->params.searchLength : current+1; zc->nextToUpdate = (matchEndIdx > current + 8) ? matchEndIdx - 8 : current+1;
return bestLength; return bestLength;
} }