mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
runtime: only implement CountString for required platforms
This commit is contained in:
committed by
Ron Evans
parent
405c0263b0
commit
efafda1d32
@@ -216,16 +216,3 @@ func indexByteString(s string, c byte) int {
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// countString copies the implementation from
|
||||
// https://github.com/golang/go/blob/67f181bfd84dfd5942fe9a29d8a20c9ce5eb2fea/src/internal/bytealg/count_generic.go#L1
|
||||
//go:linkname countString internal/bytealg.CountString
|
||||
func countString(s string, c byte) int {
|
||||
n := 0
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == c {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user