summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost/compress/flate/level1.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/klauspost/compress/flate/level1.go')
-rw-r--r--vendor/github.com/klauspost/compress/flate/level1.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/github.com/klauspost/compress/flate/level1.go b/vendor/github.com/klauspost/compress/flate/level1.go
index 0022c8bb6..0f14f8d63 100644
--- a/vendor/github.com/klauspost/compress/flate/level1.go
+++ b/vendor/github.com/klauspost/compress/flate/level1.go
@@ -154,7 +154,15 @@ func (e *fastEncL1) Encode(dst *tokens, src []byte) {
l++
}
if nextEmit < s {
- emitLiteral(dst, src[nextEmit:s])
+ if false {
+ emitLiteral(dst, src[nextEmit:s])
+ } else {
+ for _, v := range src[nextEmit:s] {
+ dst.tokens[dst.n] = token(v)
+ dst.litHist[v]++
+ dst.n++
+ }
+ }
}
// Save the match found
@@ -169,8 +177,11 @@ func (e *fastEncL1) Encode(dst *tokens, src []byte) {
for xlength > 0 {
xl := xlength
if xl > 258 {
- // We need to have at least baseMatchLength left over for next loop.
- xl = 258 - baseMatchLength
+ if xl > 258+baseMatchLength {
+ xl = 258
+ } else {
+ xl = 258 - baseMatchLength
+ }
}
xlength -= xl
xl -= baseMatchLength