small compression improvement

This commit is contained in:
Yann Collet
2015-11-04 13:57:24 +01:00
parent 59d7063fbc
commit b241e9deb7
3 changed files with 9 additions and 7 deletions
+3 -3
View File
@@ -292,7 +292,7 @@ size_t ZSTD_HC_insertBtAndFindBestMatch (
const U32 windowLow = windowSize >= current ? 0 : current - windowSize;
U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1;
U32 bestLength = 0;
size_t bestLength = 0;
U32 dummy32; /* to be nullified at the end */
hashTable[h] = (U32)(ip-base); /* Update Hash Table */
@@ -307,8 +307,8 @@ size_t ZSTD_HC_insertBtAndFindBestMatch (
if (matchLength > bestLength)
{
bestLength = (U32)matchLength;
*offsetPtr = current - matchIndex;
if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit(current-matchIndex+1) - ZSTD_highbit(offsetPtr[0]+1)) )
bestLength = matchLength, *offsetPtr = current - matchIndex;
if (ip+matchLength == iend) /* equal : no way to know if inf or sup */
break; /* drop, next to null, to guarantee consistency (is there a way to do better ?) */
}
+3 -3
View File
@@ -116,10 +116,10 @@ static const ZSTD_HC_parameters ZSTD_HC_defaultParameters[ZSTD_HC_MAX_CLEVEL+1]
{ 21, 21, 22, 6, 5, ZSTD_HC_lazydeep }, /* level 14 */
{ 22, 21, 22, 6, 5, ZSTD_HC_lazydeep }, /* level 15 */
{ 22, 21, 22, 5, 5, ZSTD_HC_btlazy2 }, /* level 16 */
{ 22, 22, 23, 5, 5, ZSTD_HC_btlazy2 }, /* level 17 */
{ 22, 23, 22, 4, 5, ZSTD_HC_btlazy2 }, /* level 17 */
{ 22, 22, 23, 7, 5, ZSTD_HC_btlazy2 }, /* level 18 */
{ 24, 24, 22, 7, 5, ZSTD_HC_btlazy2 }, /* level 19 */
{ 25, 25, 23, 8, 5, ZSTD_HC_btlazy2 }, /* level 20 */
{ 23, 23, 23, 7, 5, ZSTD_HC_btlazy2 }, /* level 19 */
{ 24, 25, 23, 8, 5, ZSTD_HC_btlazy2 }, /* level 20 */
{ 25, 25, 23, 8, 5, ZSTD_HC_btlazy2 }, /* level 21 */
{ 25, 25, 23, 8, 5, ZSTD_HC_btlazy2 }, /* level 22 */
{ 25, 25, 23, 8, 5, ZSTD_HC_btlazy2 }, /* level 23 */