(snapshot []byte)
| 86 | } |
| 87 | |
| 88 | func (s *State) Decode(snapshot []byte) { |
| 89 | dec := arith.NewDecoder(snapshot) |
| 90 | |
| 91 | s.Current().Assign(s.Baseline()) |
| 92 | historic := s.Historic().Cubes |
| 93 | baseline := s.Baseline().Cubes |
| 94 | current := s.Current().Cubes |
| 95 | |
| 96 | mzeros := mZeros() |
| 97 | |
| 98 | items := []int{} |
| 99 | for i := range current { |
| 100 | if mzeros.Decode(dec) == 1 { |
| 101 | items = append(items, i) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | for _, i := range items { |
| 106 | cube := ¤t[i] |
| 107 | cube.Interacting = int32(mzeros.Decode(dec) ^ 1) |
| 108 | } |
| 109 | |
| 110 | for _, i := range items { |
| 111 | cube, base := ¤t[i], &baseline[i] |
| 112 | v0, v1 := mzeros.Decode(dec), mzeros.Decode(dec) |
| 113 | cube.Largest = base.Largest ^ int32(v1<<1|v0) |
| 114 | } |
| 115 | |
| 116 | items6 := Index6(items, len(baseline)) |
| 117 | SortByZ(items6, Delta6(historic, baseline)) |
| 118 | set6 := SetExtra6(historic, baseline, current) |
| 119 | |
| 120 | nbits := uint(0) |
| 121 | for mzeros.Decode(dec) == 0 { |
| 122 | nbits += 1 |
| 123 | } |
| 124 | |
| 125 | if nbits == 0 { |
| 126 | for _, i := range items6 { |
| 127 | set6(i, 0) |
| 128 | } |
| 129 | return |
| 130 | } |
| 131 | |
| 132 | mvalues := mValues(nbits) |
| 133 | for _, i := range items6 { |
| 134 | z := mvalues.Decode(dec) |
| 135 | v := bit.ZDecode(uint64(z)) |
| 136 | set6(i, int32(v)) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func Index6(index []int, N int) []int { |
| 141 | r := make([]int, 0, len(index)*6) |
no test coverage detected