in cpc/pair_table.go [354:386]
func (p *pairTable) equals(other *pairTable) bool {
if p == nil && other == nil {
return true
}
if p == nil || other == nil {
return false
}
if p.validBits != other.validBits {
return false
}
if p.numPairs != other.numPairs {
return false
}
// Extract the valid pairs from each table.
a := p.unwrappingGetItems()
b := other.unwrappingGetItems()
// Sort both arrays in canonical order.
introspectiveInsertionSort(a, 0, len(a)-1)
introspectiveInsertionSort(b, 0, len(b)-1)
// Compare the sorted arrays element-by-element.
if len(a) != len(b) {
return false
}
for i := 0; i < len(a); i++ {
if a[i] != b[i] {
return false
}
}
return true
}