aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings_amd64.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/strings_amd64.go')
-rw-r--r--src/strings/strings_amd64.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/strings/strings_amd64.go b/src/strings/strings_amd64.go
index 434e2e9eb3..5e26ee2c97 100644
--- a/src/strings/strings_amd64.go
+++ b/src/strings/strings_amd64.go
@@ -9,7 +9,17 @@ package strings
// indexShortStr returns the index of the first instance of c in s, or -1 if c is not present in s.
// indexShortStr requires 2 <= len(c) <= shortStringLen
func indexShortStr(s, c string) int // ../runtime/asm_$GOARCH.s
-const shortStringLen = 31
+func supportAVX2() bool // ../runtime/asm_$GOARCH.s
+
+var shortStringLen int
+
+func init() {
+ if supportAVX2() {
+ shortStringLen = 63
+ } else {
+ shortStringLen = 31
+ }
+}
// Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
func Index(s, sep string) int {