| 108 | } |
| 109 | |
| 110 | func (e *fastBase) matchlen(s, t int32, src []byte) int32 { |
| 111 | if debugAsserts { |
| 112 | if s < 0 { |
| 113 | err := fmt.Sprintf("s (%d) < 0", s) |
| 114 | panic(err) |
| 115 | } |
| 116 | if t < 0 { |
| 117 | err := fmt.Sprintf("t (%d) < 0", t) |
| 118 | panic(err) |
| 119 | } |
| 120 | if s-t > e.maxMatchOff { |
| 121 | err := fmt.Sprintf("s (%d) - t (%d) > maxMatchOff (%d)", s, t, e.maxMatchOff) |
| 122 | panic(err) |
| 123 | } |
| 124 | if len(src)-int(s) > maxCompressedBlockSize { |
| 125 | panic(fmt.Sprintf("len(src)-s (%d) > maxCompressedBlockSize (%d)", len(src)-int(s), maxCompressedBlockSize)) |
| 126 | } |
| 127 | } |
| 128 | return int32(matchLen(src[s:], src[t:])) |
| 129 | } |
| 130 | |
| 131 | // resetBasePrefix resets the encoder state and loads prefix as initial history. |
| 132 | // This is used for parallel job encoding where non-first jobs need overlap context. |