Skip to content

Commit d4dff59

Browse files
committed
Slightly improve entropy performance
1 parent 029b84f commit d4dff59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/compress/zstd_lazy.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms,
891891
U32* const hashTable = ms->hashTable;
892892
U16* const tagTable = ms->tagTable;
893893
U32 const hashLog = ms->rowHashLog;
894+
U32 hashSaltEntropyCollected = 0;
894895
const BYTE* const base = ms->window.base;
895896

896897
DEBUGLOG(6, "ZSTD_row_update_internalImpl(): updateStartIdx=%u, updateEndIdx=%u", updateStartIdx, updateEndIdx);
@@ -906,8 +907,9 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms,
906907
assert(hash == ZSTD_hashPtrSalted(base + updateStartIdx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls, ms->hashSalt));
907908
((BYTE*)tagRow)[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK;
908909
row[pos] = updateStartIdx;
909-
ms->hashSaltEntropy += hash;
910+
hashSaltEntropyCollected = hash;
910911
}
912+
ms->hashSaltEntropy += hashSaltEntropyCollected; /* collect salt entropy */
911913
}
912914

913915
/* ZSTD_row_update_internal():

0 commit comments

Comments
 (0)