mirror of
https://github.com/facebook/zstd.git
synced 2025-11-06 00:04:27 -05:00
fix bt bug
This commit is contained in:
parent
72a8e751f4
commit
31d00ba4b3
@ -329,7 +329,7 @@ static U32 ZSTD_HC_insertBt1(ZSTD_HC_CCtx* zc, const BYTE* ip, const U32 mls, co
|
|||||||
const BYTE* const base = zc->base;
|
const BYTE* const base = zc->base;
|
||||||
const BYTE* match = base + matchIndex;
|
const BYTE* match = base + matchIndex;
|
||||||
U32 current = (U32)(ip-base);
|
U32 current = (U32)(ip-base);
|
||||||
const U32 btLow = btMask >= current ? 0 : current - btMask;
|
U32 btLow = btMask >= current ? 0 : current - btMask;
|
||||||
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;
|
||||||
U32 dummy32; /* to be nullified at the end */
|
U32 dummy32; /* to be nullified at the end */
|
||||||
@ -343,8 +343,9 @@ static U32 ZSTD_HC_insertBt1(ZSTD_HC_CCtx* zc, const BYTE* ip, const U32 mls, co
|
|||||||
size_t cyclicLength = ZSTD_count(ip+sizeof(size_t), match+sizeof(size_t), iend) + sizeof(size_t);
|
size_t cyclicLength = ZSTD_count(ip+sizeof(size_t), match+sizeof(size_t), iend) + sizeof(size_t);
|
||||||
skip = (U32)(cyclicLength - mls); /* > 1 */
|
skip = (U32)(cyclicLength - mls); /* > 1 */
|
||||||
ip += skip; /* last of segment */
|
ip += skip; /* last of segment */
|
||||||
smallerPtr += 2*skip;
|
smallerPtr = bt + 2*((current+skip) & btMask);
|
||||||
largerPtr += 2*skip;
|
largerPtr = bt + 2*((current+skip) & btMask) + 1;
|
||||||
|
btLow += skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashTable[h] = (U32)(ip - base); /* Update Hash Table */
|
hashTable[h] = (U32)(ip - base); /* Update Hash Table */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user