c-family: char8_t and aliasing in C vs C++ [PR111884]
[official-gcc.git] / libgo / go / internal / bytealg / equal_generic.go
blob59bdf8fdd5d791b364331a15c06d3d19f8a12668
1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package bytealg
7 // Equal reports whether a and b
8 // are the same length and contain the same bytes.
9 // A nil argument is equivalent to an empty slice.
11 // Equal is equivalent to bytes.Equal.
12 // It is provided here for convenience,
13 // because some packages cannot depend on bytes.
14 func Equal(a, b []byte) bool {
15 // Neither cmd/compile nor gccgo allocates for these string conversions.
16 // There is a test for this in package bytes.
17 return string(a) == string(b)