(zv scode.Bytes)
| 324 | } |
| 325 | |
| 326 | func 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. |
| 335 | func LeadingOnes(b []byte) int { |
no test coverage detected