diff options
Diffstat (limited to 'src/bytes/bytes.go')
| -rw-r--r-- | src/bytes/bytes.go | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 22aeded5e1..9d586581f5 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -12,23 +12,12 @@ import ( "unicode/utf8" ) -// Equal returns a boolean reporting whether a and b +// Equal reports whether a and b // are the same length and contain the same bytes. // A nil argument is equivalent to an empty slice. func Equal(a, b []byte) bool { - return bytealg.Equal(a, b) -} - -func equalPortable(a, b []byte) bool { - if len(a) != len(b) { - return false - } - for i, c := range a { - if c != b[i] { - return false - } - } - return true + // Neither cmd/compile nor gccgo allocates for these string conversions. + return string(a) == string(b) } // Compare returns an integer comparing two byte slices lexicographically. |
