From 833da3f33a5c727a8d7ccd034c43497c66793026 Mon Sep 17 00:00:00 2001 From: ale Date: Sat, 19 Jun 2021 16:43:43 +0100 Subject: go mod vendor --- vendor/github.com/golang/snappy/decode_other.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'vendor/github.com/golang/snappy/decode_other.go') diff --git a/vendor/github.com/golang/snappy/decode_other.go b/vendor/github.com/golang/snappy/decode_other.go index b88318e..8c9f204 100644 --- a/vendor/github.com/golang/snappy/decode_other.go +++ b/vendor/github.com/golang/snappy/decode_other.go @@ -85,28 +85,14 @@ func decode(dst, src []byte) int { if offset <= 0 || d < offset || length > len(dst)-d { return decodeErrCodeCorrupt } - // Copy from an earlier sub-slice of dst to a later sub-slice. - // If no overlap, use the built-in copy: - if offset >= length { - copy(dst[d:d+length], dst[d-offset:]) - d += length - continue - } - - // Unlike the built-in copy function, this byte-by-byte copy always runs + // Copy from an earlier sub-slice of dst to a later sub-slice. Unlike + // the built-in copy function, this byte-by-byte copy always runs // forwards, even if the slices overlap. Conceptually, this is: // // d += forwardCopy(dst[d:d+length], dst[d-offset:]) - // - // We align the slices into a and b and show the compiler they are the same size. - // This allows the loop to run without bounds checks. - a := dst[d : d+length] - b := dst[d-offset:] - b = b[:len(a)] - for i := range a { - a[i] = b[i] + for end := d + length; d != end; d++ { + dst[d] = dst[d-offset] } - d += length } if d != len(dst) { return decodeErrCodeCorrupt -- cgit v1.2.3-54-g00ecf