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

Method intMaskFastLoop

runtime/vam/expr/function/networkof.go:178–195  ·  view source on GitHub ↗
(vec *vector.IP, index []uint32, bits int)

Source from the content-addressed store, hash-verified

176}
177
178func (n *NetworkOf) intMaskFastLoop(vec *vector.IP, index []uint32, bits int) (vector.Any, []uint32) {
179 var errs []uint32
180 var nets []netip.Prefix
181 for i := range vec.Len() {
182 idx := i
183 if index != nil {
184 idx = index[i]
185 }
186 ip := vec.Values[idx]
187 net := netip.PrefixFrom(ip, bits)
188 if net.Bits() < 0 {
189 errs = append(errs, i)
190 continue
191 }
192 nets = append(nets, net.Masked())
193 }
194 return vector.NewNet(nets), errs
195}
196
197func errCIDRRange(sctx *super.Context, ipvec, maskvec vector.Any) vector.Any {
198 vec := addressAndMask(sctx, ipvec, maskvec)

Callers 1

intMaskFastMethod · 0.95

Calls 2

NewNetFunction · 0.92
LenMethod · 0.65

Tested by

no test coverage detected