fix warning and remove one more occurrence of makeEntryAndInsertByTag
This commit is contained in:
parent
e0d5eca8fa
commit
d6e3de77dc
@ -103,7 +103,7 @@ static void ZSTD_ldm_insertEntry(ldmState_t* ldmState,
|
|||||||
unsigned const offset = *pOffset;
|
unsigned const offset = *pOffset;
|
||||||
|
|
||||||
*(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + offset) = entry;
|
*(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + offset) = entry;
|
||||||
*pOffset = (offset + 1) & (((U32)1 << ldmParams.bucketSizeLog) - 1);
|
*pOffset = (BYTE)((offset + 1) & ((1u << ldmParams.bucketSizeLog) - 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,11 +295,12 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
U64 rollingHash = 0;
|
U64 rollingHash = 0;
|
||||||
|
|
||||||
while (ip <= ilimit) {
|
while (ip <= ilimit) {
|
||||||
|
U32 const currentOffset = (U32)(ip - base);
|
||||||
U32 hash, checksum;
|
U32 hash, checksum;
|
||||||
size_t mLength;
|
size_t mLength;
|
||||||
U32 const curr = (U32)(ip - base);
|
|
||||||
size_t forwardMatchLength = 0, backwardMatchLength = 0;
|
size_t forwardMatchLength = 0, backwardMatchLength = 0;
|
||||||
ldmEntry_t const* bestEntry = NULL;
|
ldmEntry_t const* bestEntry = NULL;
|
||||||
|
ldmEntry_t newEntry;
|
||||||
|
|
||||||
if (ip != istart) {
|
if (ip != istart) {
|
||||||
rollingHash = ZSTD_rollingHash_rotate(rollingHash, lastHashed[0],
|
rollingHash = ZSTD_rollingHash_rotate(rollingHash, lastHashed[0],
|
||||||
@ -319,6 +320,9 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
hash = ZSTD_ldm_getSmallHash(rollingHash, hBits);
|
hash = ZSTD_ldm_getSmallHash(rollingHash, hBits);
|
||||||
checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
|
checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
|
||||||
|
|
||||||
|
newEntry.offset = currentOffset;
|
||||||
|
newEntry.checksum = checksum;
|
||||||
|
|
||||||
/* Get the best entry and compute the match lengths */
|
/* Get the best entry and compute the match lengths */
|
||||||
{
|
{
|
||||||
ldmEntry_t* const bucket = ZSTD_ldm_getBucket(ldmState, hash, *params);
|
ldmEntry_t* const bucket = ZSTD_ldm_getBucket(ldmState, hash, *params);
|
||||||
@ -376,11 +380,7 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
|
|
||||||
/* No match found -- continue searching */
|
/* No match found -- continue searching */
|
||||||
if (bestEntry == NULL) {
|
if (bestEntry == NULL) {
|
||||||
ldmEntry_t entry;
|
ZSTD_ldm_insertEntry(ldmState, hash, newEntry, *params);
|
||||||
|
|
||||||
entry.offset = curr;
|
|
||||||
entry.checksum = checksum;
|
|
||||||
ZSTD_ldm_insertEntry(ldmState, hash, entry, *params);
|
|
||||||
ip++;
|
ip++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -391,11 +391,11 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
|
|
||||||
{
|
{
|
||||||
/* Store the sequence:
|
/* Store the sequence:
|
||||||
* ip = curr - backwardMatchLength
|
* ip = currentOffset - backwardMatchLength
|
||||||
* The match is at (bestEntry->offset - backwardMatchLength)
|
* The match is at (bestEntry->offset - backwardMatchLength)
|
||||||
*/
|
*/
|
||||||
U32 const matchIndex = bestEntry->offset;
|
U32 const matchIndex = bestEntry->offset;
|
||||||
U32 const offset = curr - matchIndex;
|
U32 const offset = currentOffset - matchIndex;
|
||||||
rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size;
|
rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size;
|
||||||
|
|
||||||
/* Out of sequence storage */
|
/* Out of sequence storage */
|
||||||
@ -407,10 +407,9 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
rawSeqStore->size++;
|
rawSeqStore->size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the current entry into the hash table */
|
/* Insert the current entry into the hash table --- it must be
|
||||||
ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits,
|
* done after the previous block to avoid clobbering bestEntry */
|
||||||
(U32)(lastHashed - base),
|
ZSTD_ldm_insertEntry(ldmState, hash, newEntry, *params);
|
||||||
*params);
|
|
||||||
|
|
||||||
assert(ip + backwardMatchLength == lastHashed);
|
assert(ip + backwardMatchLength == lastHashed);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user