diff options
| author | Keith Randall <khr@golang.org> | 2013-05-14 16:05:51 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2013-05-14 16:05:51 -0700 |
| commit | b3946dc119cb89fe9f3cd55daa8d8c7a708274a8 (patch) | |
| tree | 390057fc055fe5a503bcb633a051a2e0a14c6fda /src/pkg/bytes/bytes_decl.go | |
| parent | f1583bb9563827fe132c97798657a6c60e6a0457 (diff) | |
| download | go-b3946dc119cb89fe9f3cd55daa8d8c7a708274a8.tar.xz | |
runtime/bytes: fast Compare for byte arrays and strings.
Uses SSE instructions to process 16 bytes at a time.
fixes #5354
R=bradfitz, google
CC=golang-dev
https://golang.org/cl/8853048
Diffstat (limited to 'src/pkg/bytes/bytes_decl.go')
| -rw-r--r-- | src/pkg/bytes/bytes_decl.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/bytes/bytes_decl.go b/src/pkg/bytes/bytes_decl.go index fbf9282752..4e761f4bfb 100644 --- a/src/pkg/bytes/bytes_decl.go +++ b/src/pkg/bytes/bytes_decl.go @@ -14,3 +14,10 @@ func IndexByte(s []byte, c byte) int // asm_$GOARCH.s // Equal returns a boolean reporting whether a == b. // A nil argument is equivalent to an empty slice. func Equal(a, b []byte) bool // asm_arm.s or ../runtime/asm_{386,amd64}.s + +//go:noescape + +// Compare returns an integer comparing two byte slices lexicographically. +// The result will be 0 if a==b, -1 if a < b, and +1 if a > b. +// A nil argument is equivalent to an empty slice. +func Compare(a, b []byte) int // ../runtime/noasm_arm.goc or ../runtime/asm_{386,amd64}.s |
