aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorMichael Munday <munday@ca.ibm.com>2016-11-02 11:41:40 -0400
committerBrad Fitzpatrick <bradfitz@golang.org>2016-11-02 15:56:24 +0000
commit53cc69170ae1a96163d3b6c14467e85dc8aa7266 (patch)
tree7e2afc7b6a613f357811e3c6d928703779000413 /src/bytes
parent235f2c72e95d486b530b45e1f2a48fb629260504 (diff)
downloadgo-53cc69170ae1a96163d3b6c14467e85dc8aa7266.tar.xz
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/32574 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/bytes_s390x.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bytes/bytes_s390x.go b/src/bytes/bytes_s390x.go
index 9eec3b7b5d..988c6034aa 100644
--- a/src/bytes/bytes_s390x.go
+++ b/src/bytes/bytes_s390x.go
@@ -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)