From ea5deacd2a87e21b766334fa0569774727f838d4 Mon Sep 17 00:00:00 2001 From: Karl Gaissmaier Date: Wed, 24 Apr 2024 10:10:18 +0200 Subject: [PATCH] minor internal rewording --- stringify.go | 9 +++++---- table.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/stringify.go b/stringify.go index 93c5323..0ac5b11 100644 --- a/stringify.go +++ b/stringify.go @@ -178,23 +178,24 @@ func (n *node[V]) getKidsRec(parentIdx uint, path []byte, is4 bool) []kidT[V] { return directKids } -// cidrFromPath, make prefix from byte path, next octet (byte, stride) and pfxLen. +// cidrFromPath, make prefix from byte path, next octet and pfxLen. func cidrFromPath(path []byte, idx uint, is4 bool) (pfx netip.Prefix) { octet, pfxLen := baseIndexToPrefix(idx) // append last (partially) masked byte to path and // calc bits with pathLen and pfxLen - bs := append(slices.Clone(path), octet) + octets := append(slices.Clone(path), octet) bits := len(path)*strideLen + pfxLen + // make ip addr from octets var ip netip.Addr if is4 { b4 := [4]byte{} - copy(b4[:], bs) + copy(b4[:], octets) ip = netip.AddrFrom4(b4) } else { b16 := [16]byte{} - copy(b16[:], bs) + copy(b16[:], octets) ip = netip.AddrFrom16(b16) } diff --git a/table.go b/table.go index 4a9fb8c..c765514 100644 --- a/table.go +++ b/table.go @@ -683,7 +683,7 @@ func (t *Table[V]) Clone() *Table[V] { // Prefixes must not be inserted or deleted by the callback function, otherwise // the behavior is undefined. However, value updates are permitted. // -// The sort order is not specified and is not part of the +// The walk order is not specified and is not part of the // public interface, you must not rely on it. func (t *Table[V]) Walk(cb func(pfx netip.Prefix, val V) error) error { t.init()