Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Dec 22, 2024
1 parent 327e052 commit a43520d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ func (t *Table[V]) Contains(ip netip.Addr) bool {
n := stack[depth]
octet = octets[depth]

// longest prefix match
// micro benchmarking: skip if node has no prefixes
// longest prefix match, skip if node has no prefixes
if n.prefixes.Len() != 0 {
if ok := n.lpmTest(hostIndex(octet)); ok {
return ok
Expand Down Expand Up @@ -423,8 +422,7 @@ func (t *Table[V]) Lookup(ip netip.Addr) (val V, ok bool) {
n = stack[depth]
octet = octets[depth]

// longest prefix match
// micro benchmarking: skip if node has no prefixes
// longest prefix match, skip if node has no prefixes
if n.prefixes.Len() != 0 {
if _, val, ok = n.lpm(hostIndex(octet)); ok {
return val, ok
Expand Down Expand Up @@ -525,8 +523,7 @@ func (t *Table[V]) lpmPrefix(pfx netip.Prefix) (depth int, baseIdx uint, val V,
n = stack[depth]
octet = octets[depth]

// longest prefix match
// micro benchmarking: skip if node has no prefixes
// longest prefix match, skip if node has no prefixes
if n.prefixes.Len() != 0 {
// only the lastOctet may have a different prefix len
// all others are just host routes
Expand Down

0 comments on commit a43520d

Please sign in to comment.