diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-11-06 19:49:01 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-11-06 19:49:01 +0000 |
commit | f038dae646bac2b31be98ab592c0e5206d2d96f5 (patch) | |
tree | 39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/go/strings/strings.go | |
parent | f20f261304993444741e0f0a14d3147e591bc660 (diff) | |
download | gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.zip gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.gz gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.bz2 |
libgo: Update to October 24 version of master library.
From-SVN: r204466
Diffstat (limited to 'libgo/go/strings/strings.go')
-rw-r--r-- | libgo/go/strings/strings.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/libgo/go/strings/strings.go b/libgo/go/strings/strings.go index 986f6d6..5d46211 100644 --- a/libgo/go/strings/strings.go +++ b/libgo/go/strings/strings.go @@ -130,14 +130,7 @@ func Index(s, sep string) int { case n == 0: return 0 case n == 1: - c := sep[0] - // special case worth making fast - for i := 0; i < len(s); i++ { - if s[i] == c { - return i - } - } - return -1 + return IndexByte(s, sep[0]) case n == len(s): if sep == s { return 0 @@ -432,10 +425,7 @@ func Repeat(s string, count int) string { b := make([]byte, len(s)*count) bp := 0 for i := 0; i < count; i++ { - for j := 0; j < len(s); j++ { - b[bp] = s[j] - bp++ - } + bp += copy(b[bp:], s) } return string(b) } |