Commit 53cc6917 authored by Michael Munday's avatar Michael Munday Committed by Brad Fitzpatrick

bytes, strings: update s390x code to match amd64 changes

Updates the s390x-specific files in these packages with the changes
to the amd64-specific files made during the review of CL 31690. I'd
like to keep these files in sync unless there is a reason to
diverge.

Change-Id: Id83e5ce11a45f877bdcc991d02b14416d1a2d8d2
Reviewed-on: https://go-review.googlesource.com/32574Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 235f2c72
......@@ -32,6 +32,13 @@ func Index(s, sep []byte) int {
return 0
case n == 1:
return IndexByte(s, sep[0])
case n == len(s):
if Equal(sep, s) {
return 0
}
return -1
case n > len(s):
return -1
case n <= shortStringLen:
// Use brute force when s and sep both are small
if len(s) <= 64 {
......@@ -68,13 +75,6 @@ func Index(s, sep []byte) int {
}
}
return -1
case n == len(s):
if Equal(sep, s) {
return 0
}
return -1
case n > len(s):
return -1
}
// Rabin-Karp search
hashsep, pow := hashStr(sep)
......
......@@ -32,6 +32,13 @@ func Index(s, sep string) int {
return 0
case n == 1:
return IndexByte(s, sep[0])
case n == len(s):
if sep == s {
return 0
}
return -1
case n > len(s):
return -1
case n <= shortStringLen:
// Use brute force when s and sep both are small
if len(s) <= 64 {
......@@ -68,13 +75,6 @@ func Index(s, sep string) int {
}
}
return -1
case n == len(s):
if sep == s {
return 0
}
return -1
case n > len(s):
return -1
}
// Rabin-Karp search
hashsep, pow := hashStr(sep)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment