mirror of
https://github.com/facebook/zstd.git
synced 2025-12-09 00:03:18 -05:00
Dont log errors when ZSTD_fseBitCost() returns an error
This commit is contained in:
parent
8974906129
commit
c836992be1
@ -96,17 +96,21 @@ size_t ZSTD_fseBitCost(
|
|||||||
unsigned s;
|
unsigned s;
|
||||||
FSE_CState_t cstate;
|
FSE_CState_t cstate;
|
||||||
FSE_initCState(&cstate, ctable);
|
FSE_initCState(&cstate, ctable);
|
||||||
RETURN_ERROR_IF(ZSTD_getFSEMaxSymbolValue(ctable) < max, GENERIC,
|
if (ZSTD_getFSEMaxSymbolValue(ctable) < max) {
|
||||||
"Repeat FSE_CTable has maxSymbolValue %u < %u",
|
DEBUGLOG(5, "Repeat FSE_CTable has maxSymbolValue %u < %u",
|
||||||
ZSTD_getFSEMaxSymbolValue(ctable), max);
|
ZSTD_getFSEMaxSymbolValue(ctable), max);
|
||||||
|
return ERROR(GENERIC);
|
||||||
|
}
|
||||||
for (s = 0; s <= max; ++s) {
|
for (s = 0; s <= max; ++s) {
|
||||||
unsigned const tableLog = cstate.stateLog;
|
unsigned const tableLog = cstate.stateLog;
|
||||||
unsigned const badCost = (tableLog + 1) << kAccuracyLog;
|
unsigned const badCost = (tableLog + 1) << kAccuracyLog;
|
||||||
unsigned const bitCost = FSE_bitCost(cstate.symbolTT, tableLog, s, kAccuracyLog);
|
unsigned const bitCost = FSE_bitCost(cstate.symbolTT, tableLog, s, kAccuracyLog);
|
||||||
if (count[s] == 0)
|
if (count[s] == 0)
|
||||||
continue;
|
continue;
|
||||||
RETURN_ERROR_IF(bitCost >= badCost, GENERIC,
|
if (bitCost >= badCost) {
|
||||||
"Repeat FSE_CTable has Prob[%u] == 0", s);
|
DEBUGLOG(5, "Repeat FSE_CTable has Prob[%u] == 0", s);
|
||||||
|
return ERROR(GENERIC);
|
||||||
|
}
|
||||||
cost += count[s] * bitCost;
|
cost += count[s] * bitCost;
|
||||||
}
|
}
|
||||||
return cost >> kAccuracyLog;
|
return cost >> kAccuracyLog;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user