MCPcopy
hub / github.com/klauspost/compress / matchlen

Method matchlen

zstd/enc_base.go:110–129  ·  view source on GitHub ↗
(s, t int32, src []byte)

Source from the content-addressed store, hash-verified

108}
109
110func (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.

Callers 8

EncodeMethod · 0.45
EncodeMethod · 0.45
EncodeMethod · 0.45
EncodeMethod · 0.45
EncodeMethod · 0.45
EncodeMethod · 0.45
EncodeNoHistMethod · 0.45
EncodeMethod · 0.45

Calls 1

matchLenFunction · 0.70

Tested by

no test coverage detected