Skip to content

Commit

Permalink
enc: shallow equal name
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Feb 2, 2025
1 parent 8bfd0ad commit b8515f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions std/encoding/name_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"hash"
"io"
"strings"
"unsafe"
)

type Name []Component
Expand Down Expand Up @@ -287,6 +288,9 @@ func (n Name) Equal(rhs Name) bool {
if len(n) != len(rhs) {
return false
}
if unsafe.SliceData(n) == unsafe.SliceData(rhs) {
return true // cheap
}
for i := 0; i < len(n); i++ {
if !n[i].Equal(rhs[i]) {
return false
Expand Down

0 comments on commit b8515f1

Please sign in to comment.