mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 11:33:59 +00:00
internal/bytealg: reimplement bytealg in pure Go
Previously, we implemented individual bytealg functions via linknaming, and had to update them every once in a while when we hit linker errors. Instead, this change reimplements the bytealg package in pure Go. If something is missing, it will cause a compiler error rather than a linker error. This is easier to test and maintain.
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import "internal/bytealg"
|
||||
|
||||
// indexByte provides compatibility with Go 1.11.
|
||||
// See the following:
|
||||
// https://github.com/tinygo-org/tinygo/issues/351
|
||||
// https://github.com/golang/go/commit/ad4a58e31501bce5de2aad90a620eaecdc1eecb8
|
||||
//go:linkname indexByte strings.IndexByte
|
||||
func indexByte(s string, c byte) int {
|
||||
return indexByteString(s, c)
|
||||
return bytealg.IndexByteString(s, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user