From 1ffa80a09eec11ec098fa80da31c4fdfd3a8d134 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 4 May 2021 11:43:20 -0700 Subject: [PATCH] [easy] Rewrite rowHashLog computation `ZSTD_highbit32(1u << x) == x` when it isn't undefined behavior. --- lib/compress/zstd_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index bf0a1488..197e8ed8 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1761,7 +1761,7 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms, { /* Switch to 32-entry rows if searchLog is 5 (or more) */ U32 const rowLog = cParams->searchLog < 5 ? 4 : 5; assert(cParams->hashLog > rowLog); - ms->rowHashLog = ZSTD_highbit32((U32)1 << (cParams->hashLog - rowLog)); + ms->rowHashLog = cParams->hashLog - rowLog; } }