MCPcopy Create free account
hub / github.com/egonelbre/exp / midpoint32

Method midpoint32

coder/arith/encoding.go:12–14  ·  view source on GitHub ↗
(lo, hi uint32)

Source from the content-addressed store, hash-verified

10func NewEncoder() *Encoder { return &Encoder{lo: 0, hi: ^uint32(0)} }
11
12func (p P) midpoint32(lo, hi uint32) uint32 {
13 return lo + uint32(uint64(hi-lo)*uint64(p)>>probBits)
14}
15
16func (enc *Encoder) Encode(bit uint, prob P) {
17 x := prob.midpoint32(enc.lo, enc.hi)

Callers 2

EncodeMethod · 0.80
DecodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected