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

Method adapt

coder/arith/models.go:48–57  ·  view source on GitHub ↗
(bit uint)

Source from the content-addressed store, hash-verified

46func (m *Shift2) NBits() uint { return 1 }
47
48func (m *Shift2) adapt(bit uint) {
49 switch bit {
50 case 1:
51 m.P0 += (MaxP/2 - m.P0) >> m.I0
52 m.P1 += (MaxP/2 - m.P1) >> m.I1
53 case 0:
54 m.P0 -= m.P0 >> m.I0
55 m.P1 -= m.P1 >> m.I1
56 }
57}
58
59func (m *Shift2) Encode(enc *Encoder, bit uint) {
60 enc.Encode(bit, m.P0+m.P1)

Callers 2

EncodeMethod · 0.95
DecodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected