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

Function NewDecoder

coder/arith/encoding.go:48–58  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

46}
47
48func NewDecoder(data []byte) *Decoder {
49 dec := &Decoder{lo: 0, hi: ^uint32(0)}
50 dec.data = data
51
52 for i := 0; i < 4; i++ {
53 dec.code = dec.code<<8 | uint32(dec.data[dec.read])
54 dec.read++
55 }
56
57 return dec
58}
59
60func (dec *Decoder) Decode(prob P) (bit uint) {
61 x := prob.midpoint32(dec.lo, dec.hi)

Callers 8

DecodeMethod · 0.92
DecodeMethod · 0.92
ModelTestFunction · 0.70
TestByteModelFunction · 0.70
TestShiftZerosFunction · 0.70
TestShift2ZerosFunction · 0.70
NewReaderFunction · 0.70
TestRandomEncodeDecodeFunction · 0.70

Calls

no outgoing calls

Tested by 5

ModelTestFunction · 0.56
TestByteModelFunction · 0.56
TestShiftZerosFunction · 0.56
TestShift2ZerosFunction · 0.56
TestRandomEncodeDecodeFunction · 0.56