mirror of
https://github.com/facebook/zstd.git
synced 2025-12-10 00:06:51 -05:00
Fix compiler narrowing warning
This commit is contained in:
parent
f698ad6deb
commit
b2c39a22b0
@ -2523,9 +2523,12 @@ static size_t ZSTD_loadDictEntropyStats(ZSTD_CCtx* cctx, const void* dict, size_
|
|||||||
cctx->rep[2] = MEM_readLE32(dictPtr+8); if (cctx->rep[2] >= dictSize) return ERROR(dictionary_corrupted);
|
cctx->rep[2] = MEM_readLE32(dictPtr+8); if (cctx->rep[2] >= dictSize) return ERROR(dictionary_corrupted);
|
||||||
dictPtr += 12;
|
dictPtr += 12;
|
||||||
|
|
||||||
{ size_t const maxOffset = (dictEnd - dictPtr) + 128 KB; /* The maximum offset that must be supported */
|
{ U32 offcodeMax = MaxOff;
|
||||||
/* Calculate minimum offset code required to represent maxOffset */
|
if ((size_t)(dictEnd - dictPtr) <= ((U32)-1) - 128 KB) {
|
||||||
unsigned const offcodeMax = ZSTD_highbit32(maxOffset);
|
U32 const maxOffset = (U32)(dictEnd - dictPtr) + 128 KB; /* The maximum offset that must be supported */
|
||||||
|
/* Calculate minimum offset code required to represent maxOffset */
|
||||||
|
offcodeMax = ZSTD_highbit32(maxOffset);
|
||||||
|
}
|
||||||
/* Every possible supported offset <= dictContentSize + 128 KB must be representable */
|
/* Every possible supported offset <= dictContentSize + 128 KB must be representable */
|
||||||
CHECK_F (ZSTD_checkDictNCount(offcodeNCount, offcodeMaxValue, MIN(offcodeMax, MaxOff)));
|
CHECK_F (ZSTD_checkDictNCount(offcodeNCount, offcodeMaxValue, MIN(offcodeMax, MaxOff)));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user