MCPcopy Create free account
hub / github.com/coder/wush / comparePrefix

Function comparePrefix

tsserver/server.go:776–784  ·  view source on GitHub ↗

TODO(kradalby): Remove after go 1.23, will be in stdlib. Compare returns an integer comparing two prefixes. The result will be 0 if p == p2, -1 if p < p2, and +1 if p > p2. Prefixes sort first by validity (invalid before valid), then address family (IPv4 before IPv6), then prefix length, then addres

(p, p2 netip.Prefix)

Source from the content-addressed store, hash-verified

774// address family (IPv4 before IPv6), then prefix length, then
775// address.
776func comparePrefix(p, p2 netip.Prefix) int {
777 if c := cmp.Compare(p.Addr().BitLen(), p2.Addr().BitLen()); c != 0 {
778 return c
779 }
780 if c := cmp.Compare(p.Bits(), p2.Bits()); c != 0 {
781 return c
782 }
783 return p.Addr().Compare(p2.Addr())
784}
785
786type mapRequestType int
787

Callers 1

hostInfoChangedFunction · 0.85

Calls 1

AddrMethod · 0.80

Tested by

no test coverage detected