MCPcopy
hub / github.com/klauspost/compress / minSize

Method minSize

huff0/huff0.go:323–333  ·  view source on GitHub ↗

minSize returns the minimum possible size considering the shannon limit.

(total int)

Source from the content-addressed store, hash-verified

321
322// minSize returns the minimum possible size considering the shannon limit.
323func (s *Scratch) minSize(total int) int {
324 nbBits := float64(7)
325 fTotal := float64(total)
326 for _, v := range s.count[:s.symbolLen] {
327 n := float64(v)
328 if n > 0 {
329 nbBits += math.Log2(fTotal/n) * n
330 }
331 }
332 return int(nbBits) >> 3
333}
334
335func highBit32(val uint32) (n uint32) {
336 return uint32(bits.Len32(val) - 1)

Callers 3

FuzzCompressFunction · 0.95
TestCompress1XFunction · 0.95
TestCompress1XMustReuseFunction · 0.95

Calls

no outgoing calls

Tested by 3

FuzzCompressFunction · 0.76
TestCompress1XFunction · 0.76
TestCompress1XMustReuseFunction · 0.76