|
@@ -195,8 +195,15 @@ func encodeBlock(dst, src []byte) (d int) {
|
|
|
// Invariant: we have a 4-byte match at s, and no need to emit any
|
|
// Invariant: we have a 4-byte match at s, and no need to emit any
|
|
|
// literal bytes prior to s.
|
|
// literal bytes prior to s.
|
|
|
base := s
|
|
base := s
|
|
|
|
|
+
|
|
|
// Extend the 4-byte match as long as possible.
|
|
// Extend the 4-byte match as long as possible.
|
|
|
- s = extendMatch(src, candidate+4, s+4)
|
|
|
|
|
|
|
+ //
|
|
|
|
|
+ // This is an inlined version of:
|
|
|
|
|
+ // s = extendMatch(src, candidate+4, s+4)
|
|
|
|
|
+ s += 4
|
|
|
|
|
+ for i := candidate + 4; s < len(src) && src[i] == src[s]; i, s = i+1, s+1 {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
d += emitCopy(dst[d:], base-candidate, s-base)
|
|
d += emitCopy(dst[d:], base-candidate, s-base)
|
|
|
nextEmit = s
|
|
nextEmit = s
|
|
|
if s >= sLimit {
|
|
if s >= sLimit {
|