diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-17 17:25:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-17 17:25:21 +0100 |
commit | 8f1ce4bddd54fe8067cca688430a7099c5f42cd1 (patch) | |
tree | 1c6f2e629375a9ab1532d769440f183f50c33dcc /vendor/github.com/klauspost/compress/zstd/zstd.go | |
parent | 9ef5d28759e6d37c6f5c1f07df4cf676077851dc (diff) | |
parent | 8081d9c74552612ad73fef27e5775fcfb371e812 (diff) | |
download | podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.tar.gz podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.tar.bz2 podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.zip |
Merge pull request #5524 from rhatdan/vendor
Update containers/storage to v1.16.5
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/zstd.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/zstd/zstd.go | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/zstd.go b/vendor/github.com/klauspost/compress/zstd/zstd.go index 5e0b64ccc..0807719c8 100644 --- a/vendor/github.com/klauspost/compress/zstd/zstd.go +++ b/vendor/github.com/klauspost/compress/zstd/zstd.go @@ -87,6 +87,17 @@ func printf(format string, a ...interface{}) { } } +// matchLenFast does matching, but will not match the last up to 7 bytes. +func matchLenFast(a, b []byte) int { + endI := len(a) & (math.MaxInt32 - 7) + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + return i + bits.TrailingZeros64(diff)>>3 + } + } + return endI +} + // matchLen returns the maximum length. // a must be the shortest of the two. // The function also returns whether all bytes matched. @@ -97,33 +108,18 @@ func matchLen(a, b []byte) int { return i + (bits.TrailingZeros64(diff) >> 3) } } + checked := (len(a) >> 3) << 3 a = a[checked:] b = b[checked:] - // TODO: We could do a 4 check. for i := range a { if a[i] != b[i] { - return int(i) + checked + return i + checked } } return len(a) + checked } -// matchLen returns a match length in src between index s and t -func matchLenIn(src []byte, s, t int32) int32 { - s1 := len(src) - b := src[t:] - a := src[s:s1] - b = b[:len(a)] - // Extend the match to be as long as possible. - for i := range a { - if a[i] != b[i] { - return int32(i) - } - } - return int32(len(a)) -} - func load3232(b []byte, i int32) uint32 { // Help the compiler eliminate bounds checks on the read so it can be done in a single read. b = b[i:] |