strings: use runtime assembly for IndexByte

Fixes #3751

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12483043
This commit is contained in:
Brad Fitzpatrick 2013-08-05 15:04:05 -07:00
parent 8ce8adbe7a
commit 598c78967f
6 changed files with 75 additions and 15 deletions

View file

@ -160,16 +160,6 @@ func Index(s, sep string) int {
return -1
}
// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
func IndexByte(s string, c byte) int {
for i := 0; i < len(s); i++ {
if s[i] == c {
return i
}
}
return -1
}
// LastIndex returns the index of the last instance of sep in s, or -1 if sep is not present in s.
func LastIndex(s, sep string) int {
n := len(sep)