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

Method adapt

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

Source from the content-addressed store, hash-verified

75func (m *Shift4) NBits() uint { return 1 }
76
77func (m *Shift4) adapt(bit uint) {
78 switch bit {
79 case 1:
80 m.P[0] += (MaxP/4 - m.P[0]) >> m.I[0]
81 m.P[1] += (MaxP/4 - m.P[1]) >> m.I[1]
82 m.P[2] += (MaxP/4 - m.P[2]) >> m.I[2]
83 m.P[3] += (MaxP/4 - m.P[3]) >> m.I[3]
84 case 0:
85 m.P[0] -= m.P[0] >> m.I[0]
86 m.P[1] -= m.P[1] >> m.I[1]
87 m.P[2] -= m.P[2] >> m.I[2]
88 m.P[3] -= m.P[3] >> m.I[3]
89 }
90}
91
92func (m *Shift4) Encode(enc *Encoder, bit uint) {
93 enc.Encode(bit, m.P[0]+m.P[1]+m.P[2]+m.P[3])

Callers 2

EncodeMethod · 0.95
DecodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected