github.com/primecitizens/pcz/std@v0.2.1/core/cmp/bs.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2021 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 package cmp 9 10 // BytesEqual reports whether a and b are the same length and contain the 11 // same bytes. 12 // A nil argument is equivalent to an empty slice. 13 func BytesEqual(a, b []byte) bool { 14 // Neither cmd/compile nor gccgo allocates for these string conversions. 15 // There is a test for this in package bytes. 16 return string(a) == string(b) 17 } 18 19 // StringEqual reports whether a and b are the same length and contain the 20 // same bytes. 21 func StringEqual(a, b string) bool { 22 return a == b 23 }