aboutsummaryrefslogtreecommitdiff
path: root/src/internal/bytealg/compare_generic.go
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2018-11-05 11:00:01 -0800
committerKeith Randall <khr@golang.org>2018-11-08 20:52:47 +0000
commitad4a58e31501bce5de2aad90a620eaecdc1eecb8 (patch)
treee08af15fd1be09d25d23e0b18ea9e8dc9f2d2c80 /src/internal/bytealg/compare_generic.go
parent742be070b6109d32a5e91d13a75542aefc892ee1 (diff)
downloadgo-ad4a58e31501bce5de2aad90a620eaecdc1eecb8.tar.xz
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/internal/bytealg/compare_generic.go')
-rw-r--r--src/internal/bytealg/compare_generic.go28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/internal/bytealg/compare_generic.go b/src/internal/bytealg/compare_generic.go
index 5c35a1ac4a..2ac60f3df9 100644
--- a/src/internal/bytealg/compare_generic.go
+++ b/src/internal/bytealg/compare_generic.go
@@ -35,34 +35,6 @@ samebytes:
return 0
}
-//go:linkname bytes_Compare bytes.Compare
-func bytes_Compare(a, b []byte) int {
- l := len(a)
- if len(b) < l {
- l = len(b)
- }
- if l == 0 || &a[0] == &b[0] {
- goto samebytes
- }
- for i := 0; i < l; i++ {
- c1, c2 := a[i], b[i]
- if c1 < c2 {
- return -1
- }
- if c1 > c2 {
- return +1
- }
- }
-samebytes:
- if len(a) < len(b) {
- return -1
- }
- if len(a) > len(b) {
- return +1
- }
- return 0
-}
-
//go:linkname runtime_cmpstring runtime.cmpstring
func runtime_cmpstring(a, b string) int {
l := len(a)