(bit uint)
| 75 | func (m *Shift4) NBits() uint { return 1 } |
| 76 | |
| 77 | func (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 | |
| 92 | func (m *Shift4) Encode(enc *Encoder, bit uint) { |
| 93 | enc.Encode(bit, m.P[0]+m.P[1]+m.P[2]+m.P[3]) |