From: Nick Terrell Date: Tue, 4 May 2021 18:43:20 +0000 (-0700) Subject: [easy] Rewrite rowHashLog computation X-Git-Tag: v1.5.0^2~43^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ffa80a09eec11ec098fa80da31c4fdfd3a8d134;p=thirdparty%2Fzstd.git [easy] Rewrite rowHashLog computation `ZSTD_highbit32(1u << x) == x` when it isn't undefined behavior. --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index bf0a14888..197e8ed8a 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; } }