Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Jan 4, 2025
1 parent e1d123c commit 080b4ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestOverlapsNode(t *testing.T) {
}

gotGold := gold.strideOverlaps(&goldInter)
gotFast := fast.overlapsRec(fastInter, 0)
gotFast := fast.overlaps(fastInter, 0)
if gotGold != gotFast {
t.Fatalf("node.overlaps = %v, want %v", gotFast, gotGold)
}
Expand Down
12 changes: 6 additions & 6 deletions overlaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/gaissmai/bart/internal/bitset"
)

// overlapsRec returns true if any IP in the nodes n or o overlaps.
func (n *node[V]) overlapsRec(o *node[V], depth int) bool {
// overlaps returns true if any IP in the nodes n or o overlaps.
func (n *node[V]) overlaps(o *node[V], depth int) bool {
nPfxCount := n.prefixes.Len()
oPfxCount := o.prefixes.Len()

Expand Down Expand Up @@ -69,7 +69,7 @@ func (n *node[V]) overlapsRec(o *node[V], depth int) bool {
return false
}

return n.overlapsSameChildrenRec(o, depth)
return n.overlapsSameChildren(o, depth)
}

// overlapsRoutes, test if n overlaps o prefixes and vice versa
Expand Down Expand Up @@ -170,8 +170,8 @@ func (n *node[V]) overlapsChildrenIn(o *node[V]) bool {
return prefixRoutes.IntersectionCardinality(hostRoutes) > 0
}

// overlapsSameChildrenRec, find same octets with bitset intersection.
func (n *node[V]) overlapsSameChildrenRec(o *node[V], depth int) bool {
// overlapsSameChildren, find same octets with bitset intersection.
func (n *node[V]) overlapsSameChildren(o *node[V], depth int) bool {
var nChildrenBitsetCloned bitset.BitSet = make([]uint64, 4)
copy(nChildrenBitsetCloned, n.children.BitSet)

Expand Down Expand Up @@ -207,7 +207,7 @@ func overlapsTwoChilds[V any](nChild, oChild any, depth int) bool {
case *node[V]:
switch oKind := oChild.(type) {
case *node[V]: // node, node
return nKind.overlapsRec(oKind, depth+1) // node, node
return nKind.overlaps(oKind, depth+1) // node, node
case *leaf[V]: // node, leaf
return nKind.overlapsPrefixAtDepth(oKind.prefix, depth) // node, node
}
Expand Down
4 changes: 2 additions & 2 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func (t *Table[V]) Overlaps4(o *Table[V]) bool {
if t.size4 == 0 || o.size4 == 0 {
return false
}
return t.root4.overlapsRec(&o.root4, 0)
return t.root4.overlaps(&o.root4, 0)
}

// Overlaps6 reports whether any IPv6 in the table matches a route in the
Expand All @@ -686,7 +686,7 @@ func (t *Table[V]) Overlaps6(o *Table[V]) bool {
if t.size6 == 0 || o.size6 == 0 {
return false
}
return t.root6.overlapsRec(&o.root6, 0)
return t.root6.overlaps(&o.root6, 0)
}

// Union combines two tables, changing the receiver table.
Expand Down

0 comments on commit 080b4ea

Please sign in to comment.