aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/strings_amd64.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/strings/strings_amd64.go b/src/strings/strings_amd64.go
index 33771480a6..a9c01bbf7f 100644
--- a/src/strings/strings_amd64.go
+++ b/src/strings/strings_amd64.go
@@ -4,19 +4,19 @@
package strings
+import "internal/cpu"
+
//go:noescape
// 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
-func supportAVX2() bool // ../runtime/asm_$GOARCH.s
-func supportPOPCNT() bool // ../runtime/asm_$GOARCH.s
-func countByte(s string, c byte) int // ../runtime/asm_$GOARCH.s
+func indexShortStr(s, c string) int // ../runtime/asm_amd64.s
+func countByte(s string, c byte) int // ../runtime/asm_amd64.s
var shortStringLen int
func init() {
- if supportAVX2() {
+ if cpu.X86.HasAVX2 {
shortStringLen = 63
} else {
shortStringLen = 31
@@ -99,7 +99,7 @@ func Index(s, substr string) int {
// Count counts the number of non-overlapping instances of substr in s.
// If substr is an empty string, Count returns 1 + the number of Unicode code points in s.
func Count(s, substr string) int {
- if len(substr) == 1 && supportPOPCNT() {
+ if len(substr) == 1 && cpu.X86.HasPOPCNT {
return countByte(s, byte(substr[0]))
}
return countGeneric(s, substr)