Faster literals cost evaluation (suggested by @inikep)
parent
e93add0439
commit
0068be94d8
|
@ -79,8 +79,9 @@ FORCE_INLINE U32 ZSTD_getLiteralPriceReal(seqStore_t* seqStorePtr, U32 litLength
|
||||||
if (!litLength) return 1; /* special case */
|
if (!litLength) return 1; /* special case */
|
||||||
|
|
||||||
/* literals */
|
/* literals */
|
||||||
for (u=0, price=0; u < litLength; u++)
|
price = litLength * ZSTD_highbit(seqStorePtr->litSum);
|
||||||
price += ZSTD_highbit(seqStorePtr->litSum) - ZSTD_highbit(seqStorePtr->litFreq[literals[u]]);
|
for (u=0; u < litLength; u++)
|
||||||
|
price -= ZSTD_highbit(seqStorePtr->litFreq[literals[u]]);
|
||||||
|
|
||||||
/* literal Length */
|
/* literal Length */
|
||||||
price += ((litLength >= MaxLL)*8) + ((litLength >= 255+MaxLL)*16) + ((litLength>=(1<<15))*8);
|
price += ((litLength >= MaxLL)*8) + ((litLength >= 255+MaxLL)*16) + ((litLength>=(1<<15))*8);
|
||||||
|
|
Loading…
Reference in New Issue