mirror of
https://github.com/facebook/zstd.git
synced 2025-12-01 00:02:43 -05:00
minor fast mode improvement
This commit is contained in:
parent
2cc12cb3cb
commit
96ffa424eb
@ -787,7 +787,8 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* zc,
|
|||||||
const size_t h = ZSTD_hashPtr(ip, hBits, mls);
|
const size_t h = ZSTD_hashPtr(ip, hBits, mls);
|
||||||
const U32 matchIndex = hashTable[h];
|
const U32 matchIndex = hashTable[h];
|
||||||
const BYTE* match = base + matchIndex;
|
const BYTE* match = base + matchIndex;
|
||||||
hashTable[h] = (U32)(ip-base);
|
const U32 current = (U32)(ip-base);
|
||||||
|
hashTable[h] = current; /* update hash table */
|
||||||
|
|
||||||
if (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)) /* note : by construction, offset_1 <= (ip-base) */
|
if (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)) /* note : by construction, offset_1 <= (ip-base) */
|
||||||
{
|
{
|
||||||
@ -818,7 +819,7 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* zc,
|
|||||||
if (ip <= ilimit)
|
if (ip <= ilimit)
|
||||||
{
|
{
|
||||||
/* Fill Table */
|
/* Fill Table */
|
||||||
hashTable[ZSTD_hashPtr(ip-(mlCode+MINMATCH)+2, hBits, mls)] = (U32)(ip-(mlCode+MINMATCH)+2-base); /* here because ip-(mlCode+MINMATCH)+2 could be > iend-8 without ip <= ilimit check*/
|
hashTable[ZSTD_hashPtr(base+current+2, hBits, mls)] = current+2; /* here because current+2 could be > iend-8 without ip <= ilimit check*/
|
||||||
hashTable[ZSTD_hashPtr(ip-2, hBits, mls)] = (U32)(ip-2-base);
|
hashTable[ZSTD_hashPtr(ip-2, hBits, mls)] = (U32)(ip-2-base);
|
||||||
/* check immediate repcode */
|
/* check immediate repcode */
|
||||||
while ( (ip <= ilimit)
|
while ( (ip <= ilimit)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user