MCPcopy Create free account
hub / github.com/brimdata/super / DecodeNet

Function DecodeNet

primitive.go:326–332  ·  view source on GitHub ↗
(zv scode.Bytes)

Source from the content-addressed store, hash-verified

324}
325
326func DecodeNet(zv scode.Bytes) netip.Prefix {
327 a, ok := netip.AddrFromSlice(zv[:len(zv)/2])
328 if !ok {
329 panic("failure trying to decode IP subnet that is not 8 or 32 bytes long")
330 }
331 return netip.PrefixFrom(a, LeadingOnes(zv[len(zv)/2:]))
332}
333
334// LeadingOnes returns the number of leading one bits in b.
335func LeadingOnes(b []byte) int {

Callers 11

NewConstFromValueFunction · 0.92
WriteMethod · 0.92
formatPrimitiveFunction · 0.92
loadAnyWithLockMethod · 0.92
NewSearchFunction · 0.92
NewSearchFunction · 0.92
CallMethod · 0.92
EqualFunction · 0.92
formatAnyFunction · 0.92
buildArrowValueMethod · 0.92
writePrimitiveMethod · 0.92

Calls 1

LeadingOnesFunction · 0.85

Tested by

no test coverage detected