mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
bytes, strings: use copy in Repeat
R=golang-dev, dave, bradfitz, adg CC=golang-dev https://golang.org/cl/13249043
This commit is contained in:
parent
b2e937970b
commit
f033d988b1
2 changed files with 2 additions and 8 deletions
|
|
@ -375,10 +375,7 @@ func Repeat(b []byte, count int) []byte {
|
|||
nb := make([]byte, len(b)*count)
|
||||
bp := 0
|
||||
for i := 0; i < count; i++ {
|
||||
for j := 0; j < len(b); j++ {
|
||||
nb[bp] = b[j]
|
||||
bp++
|
||||
}
|
||||
bp += copy(nb[bp:], b)
|
||||
}
|
||||
return nb
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue