From f038dae646bac2b31be98ab592c0e5206d2d96f5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 6 Nov 2013 19:49:01 +0000 Subject: libgo: Update to October 24 version of master library. From-SVN: r204466 --- libgo/go/strings/strings.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'libgo/go/strings/strings.go') 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) } -- cgit v1.1