Merge pull request #4344 from Cyan4973/assert1

add an assert
This commit is contained in:
Yann Collet 2025-03-24 18:32:37 -07:00 committed by GitHub
commit 64dc08f47f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -425,6 +425,7 @@ static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 targetNbBits
* gain back half the rank.
*/
U32 nBitsToDecrease = ZSTD_highbit32((U32)totalCost) + 1;
assert(nBitsToDecrease <= HUF_TABLELOG_MAX+1);
for ( ; nBitsToDecrease > 1; nBitsToDecrease--) {
U32 const highPos = rankLast[nBitsToDecrease];
U32 const lowPos = rankLast[nBitsToDecrease-1];