diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-12 18:25:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 18:25:00 +0200 |
commit | 7203e0a76a82e278b6a41e7a5851463a0b2f571e (patch) | |
tree | 04252a3261ecba007ace7055154fc8d2ce8a9aea /vendor/github.com/klauspost/compress/zstd/blockenc.go | |
parent | 3803a2630f2bc53f18cbf2b7a825ff1b068a0fb7 (diff) | |
parent | 3627c4b691a357fc531c2761f07ccfecf937dd12 (diff) | |
download | podman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.tar.gz podman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.tar.bz2 podman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.zip |
Merge pull request #9994 from containers/dependabot/go_modules/github.com/containers/image/v5-5.11.0
Bump github.com/containers/image/v5 from 5.10.5 to 5.11.0
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/blockenc.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/zstd/blockenc.go | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/blockenc.go b/vendor/github.com/klauspost/compress/zstd/blockenc.go index c85c40255..9647c64e5 100644 --- a/vendor/github.com/klauspost/compress/zstd/blockenc.go +++ b/vendor/github.com/klauspost/compress/zstd/blockenc.go @@ -22,28 +22,44 @@ type blockEnc struct { dictLitEnc *huff0.Scratch wr bitWriter - extraLits int - last bool - + extraLits int output []byte recentOffsets [3]uint32 prevRecentOffsets [3]uint32 + + last bool + lowMem bool } // init should be used once the block has been created. // If called more than once, the effect is the same as calling reset. func (b *blockEnc) init() { - if cap(b.literals) < maxCompressedLiteralSize { - b.literals = make([]byte, 0, maxCompressedLiteralSize) - } - const defSeqs = 200 - b.literals = b.literals[:0] - if cap(b.sequences) < defSeqs { - b.sequences = make([]seq, 0, defSeqs) - } - if cap(b.output) < maxCompressedBlockSize { - b.output = make([]byte, 0, maxCompressedBlockSize) + if b.lowMem { + // 1K literals + if cap(b.literals) < 1<<10 { + b.literals = make([]byte, 0, 1<<10) + } + const defSeqs = 20 + if cap(b.sequences) < defSeqs { + b.sequences = make([]seq, 0, defSeqs) + } + // 1K + if cap(b.output) < 1<<10 { + b.output = make([]byte, 0, 1<<10) + } + } else { + if cap(b.literals) < maxCompressedBlockSize { + b.literals = make([]byte, 0, maxCompressedBlockSize) + } + const defSeqs = 200 + if cap(b.sequences) < defSeqs { + b.sequences = make([]seq, 0, defSeqs) + } + if cap(b.output) < maxCompressedBlockSize { + b.output = make([]byte, 0, maxCompressedBlockSize) + } } + if b.coders.mlEnc == nil { b.coders.mlEnc = &fseEncoder{} b.coders.mlPrev = &fseEncoder{} |