[easy] Rewrite rowHashLog computation

`ZSTD_highbit32(1u << x) == x` when it isn't undefined behavior.
This commit is contained in:
Nick Terrell 2021-05-04 11:43:20 -07:00
parent a8ecf4ff88
commit 1ffa80a09e

View File

@ -1761,7 +1761,7 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms,
{ /* Switch to 32-entry rows if searchLog is 5 (or more) */ { /* Switch to 32-entry rows if searchLog is 5 (or more) */
U32 const rowLog = cParams->searchLog < 5 ? 4 : 5; U32 const rowLog = cParams->searchLog < 5 ? 4 : 5;
assert(cParams->hashLog > rowLog); assert(cParams->hashLog > rowLog);
ms->rowHashLog = ZSTD_highbit32((U32)1 << (cParams->hashLog - rowLog)); ms->rowHashLog = cParams->hashLog - rowLog;
} }
} }