gcc/libgo/go/compress/flate/copy.go
Ian Lance Taylor 4ccad563d2 libgo: Update to current sources.
From-SVN: r192704
2012-10-23 04:31:11 +00:00

18 lines
464 B
Go

// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package flate
// forwardCopy is like the built-in copy function except that it always goes
// forward from the start, even if the dst and src overlap.
func forwardCopy(dst, src []byte) int {
if len(src) > len(dst) {
src = src[:len(dst)]
}
for i, x := range src {
dst[i] = x
}
return len(src)
}