diff options
author | Keith Randall <khr@google.com> | 2018-11-05 11:00:01 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2018-11-08 20:52:47 +0000 |
commit | ad4a58e31501bce5de2aad90a620eaecdc1eecb8 (patch) | |
tree | e08af15fd1be09d25d23e0b18ea9e8dc9f2d2c80 /src/strings | |
parent | 742be070b6109d32a5e91d13a75542aefc892ee1 (diff) | |
download | go-ad4a58e31501bce5de2aad90a620eaecdc1eecb8.tar.gz go-ad4a58e31501bce5de2aad90a620eaecdc1eecb8.zip |
strings,bytes: use inlineable function trampolines instead of linkname
Cleans things up quite a bit.
There's still a few more, like runtime.cmpstring, which might also
be worth fixing.
Change-Id: Ide18dd621efc129cc686db223f47fa0b044b5580
Reviewed-on: https://go-review.googlesource.com/c/148578
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/strings')
-rw-r--r-- | src/strings/strings.go | 5 | ||||
-rw-r--r-- | src/strings/strings_decl.go | 10 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go index 8ce2abfdf8..a98f5d8ff1 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -146,6 +146,11 @@ func LastIndex(s, substr string) int { return -1 } +// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. +func IndexByte(s string, c byte) int { + return bytealg.IndexByteString(s, c) +} + // IndexRune returns the index of the first instance of the Unicode code point // r, or -1 if rune is not present in s. // If r is utf8.RuneError, it returns the first instance of any diff --git a/src/strings/strings_decl.go b/src/strings/strings_decl.go deleted file mode 100644 index 6718c3ace4..0000000000 --- a/src/strings/strings_decl.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package strings - -//go:noescape - -// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. -func IndexByte(s string, c byte) int // in internal/bytealg |