From b417f62b00276a2ccca3fa7e490f3673a1df8a4c Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 7 Nov 2022 17:43:24 +0100 Subject: [PATCH] net/netip: remove unused unexported functions and methods Change-Id: I71774ad0197ce654dc56c2fa2fa12f1e6696382e Reviewed-on: https://go-review.googlesource.com/c/go/+/448395 Run-TryBot: Tobias Klauser Reviewed-by: Ian Lance Taylor Auto-Submit: Tobias Klauser TryBot-Result: Gopher Robot Reviewed-by: Michael Knyszek --- src/net/netip/inlining_test.go | 3 --- src/net/netip/netip.go | 5 ----- src/net/netip/uint128.go | 11 ----------- 3 files changed, 19 deletions(-) diff --git a/src/net/netip/inlining_test.go b/src/net/netip/inlining_test.go index 52991bee8c..b521eeebfd 100644 --- a/src/net/netip/inlining_test.go +++ b/src/net/netip/inlining_test.go @@ -42,7 +42,6 @@ func TestInlining(t *testing.T) { "Addr.IsValid", "Addr.IsUnspecified", "Addr.Less", - "Addr.lessOrEq", "Addr.Unmap", "Addr.Zone", "Addr.v4", @@ -81,8 +80,6 @@ func TestInlining(t *testing.T) { case "amd64", "arm64": // These don't inline on 32-bit. wantInlinable = append(wantInlinable, - "u64CommonPrefixLen", - "uint128.commonPrefixLen", "Addr.Next", "Addr.Prev", ) diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index 2d7c838499..1542af1d1b 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -459,8 +459,6 @@ func (ip Addr) Compare(ip2 Addr) int { // IPv6 addresses with zones sort just after the same address without a zone. func (ip Addr) Less(ip2 Addr) bool { return ip.Compare(ip2) == -1 } -func (ip Addr) lessOrEq(ip2 Addr) bool { return ip.Compare(ip2) <= 0 } - // Is4 reports whether ip is an IPv4 address. // // It returns false for IPv4-mapped IPv6 addresses. See Addr.Unmap. @@ -1118,9 +1116,6 @@ func MustParseAddrPort(s string) AddrPort { return ip } -// isZero reports whether p is the zero AddrPort. -func (p AddrPort) isZero() bool { return p == AddrPort{} } - // IsValid reports whether p.Addr() is valid. // All ports are valid, including zero. func (p AddrPort) IsValid() bool { return p.ip.IsValid() } diff --git a/src/net/netip/uint128.go b/src/net/netip/uint128.go index 738939d7de..b1605afbe7 100644 --- a/src/net/netip/uint128.go +++ b/src/net/netip/uint128.go @@ -60,17 +60,6 @@ func (u uint128) addOne() uint128 { return uint128{u.hi + carry, lo} } -func u64CommonPrefixLen(a, b uint64) uint8 { - return uint8(bits.LeadingZeros64(a ^ b)) -} - -func (u uint128) commonPrefixLen(v uint128) (n uint8) { - if n = u64CommonPrefixLen(u.hi, v.hi); n == 64 { - n += u64CommonPrefixLen(u.lo, v.lo) - } - return -} - // halves returns the two uint64 halves of the uint128. // // Logically, think of it as returning two uint64s. -- 2.50.0