]> Cypherpunks repositories - gostls13.git/commitdiff
bytes, strings: update s390x code to match amd64 changes
authorMichael Munday <munday@ca.ibm.com>
Wed, 2 Nov 2016 15:41:40 +0000 (11:41 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 2 Nov 2016 15:56:24 +0000 (15:56 +0000)
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>
src/bytes/bytes_s390x.go
src/strings/strings_s390x.go

index 9eec3b7b5dde53087ffc62b2510063febc8be0c2..988c6034aa54350d7f809d5d9a49ecff759b67f8 100644 (file)
@@ -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)
index 64204ab09ecf5c16f93ea200e4b3f3cf2c0a44df..316a1b896bc31c06e124e137a5206b2a3f02da8f 100644 (file)
@@ -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)