// anyLoopIntersects reports whether any loop in this polygon intersects the given loop.
973171
func (p *Polygon) anyLoopIntersects(o *Loop) bool {
	for _, l := range p.loops {
		if l.Intersects(o) {
			return true
		}
	}
	return false
}
629557
func (s *Selection) NextMatcherUntilSelection(filter Matcher, sel *Selection) *Selection {
	if sel == nil {
		return s.NextMatcher(filter)
	}
	return s.NextMatcherUntilNodes(filter, sel.Nodes...)
}
1086672
func (rcv Holds) Any(fn func(*Hold) bool) bool {
	for _, v := range rcv {
		if fn(v) {
			return true
		}
	}
	return false
}
489925
func AnyOverlap(x, y []byte) bool {
	return len(x) > 0 && len(y) > 0 &&
		reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
		reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
}
447956
func (r *BulkUpdateRequest) DetectNoop(detectNoop bool) *BulkUpdateRequest {
	r.detectNoop = &detectNoop
	r.source = nil
	return r
}
592157
func AnyMatch(peerPool []discovery.NetworkMember, filters ...RoutingFilter) []discovery.NetworkMember {
	var res []discovery.NetworkMember
	for _, peer := range peerPool {
		for _, matches := range filters {
			if matches(peer) {
				res = append(res, peer)
				break
			}
		}
	}
	return res
}
643774
func SortedIntersectUint64(args ...[]uint64) []uint64 {
	// create an array to hold the intersection and write the first array to it
	tempIntersection := args[0]
	argsLen := len(args)

	for k := 1; k < argsLen; k++ {
		// do we have any intersections?
		switch len(tempIntersection) {
		case 0:
			// nope! Give them an empty array!
			return tempIntersection

		default:
			// yup, keep chugging
			tempIntersection = sortedIntersectUintHelper(tempIntersection, args[k])
		}
	}

	return tempIntersection
}
618451
func IntInSlice(a int, list []int) bool {
	for _, b := range list {
		if b == a {
			return true
		}
	}
	return false
}
96382
func routesIntersection(routesSlices ...[]*Route) []*Route {
	var filtered [][]*Route
	for _, routes := range routesSlices {
		if len(routes) > 0 {
			filtered = append(filtered, routes)
		}
	}
	if len(filtered) == 0 {
		return nil
	}
	if len(filtered) == 1 {
		return filtered[0]
	}
	maps := make([]map[uintptr]bool, len(filtered))
	for i, routes := range filtered {
		m := make(map[uintptr]bool)
		for _, route := range routes {
			m[uintptr(unsafe.Pointer(route))] = true
		}
		maps[i] = m
	}
	intersect := maps[0]
	for i := 1; i < len(maps); i++ {
		check := maps[i]
		for key := range intersect {
			if _, ok := check[key]; !ok {
				delete(intersect, key)
			}
		}
		if len(intersect) == 0 {
			return nil
		}
	}
	ret := make([]*Route, len(intersect))
	i := 0
	for ptr := range intersect {
		ret[i] = (*Route)(unsafe.Pointer(ptr))
		i++
	}
	return ret
}
586099
func IsLoopback(addr string) bool {
	host, _, err := net.SplitHostPort(strings.ToLower(addr))
	if err != nil {
		host = addr // happens if the addr is just a hostname
	}
	return host == "localhost" ||
		strings.Trim(host, "[]") == "::1" ||
		strings.HasPrefix(host, "127.")
}
1101815
func (b *Bitmap) Any() bool {
	iter, _ := b.Containers.Iterator(0)
	// TODO (jaffee) I'm not sure if it's possible/legal to have an empty
	// container, so this loop may be totally unnecessary. In theory, any empty
	// container should be removed from the bitmap though.
	for iter.Next() {
		_, c := iter.Value()
		if c.n > 0 {
			return true
		}
	}
	return false
}
1133485
func eventLoop(ctx context.Context, config Config, eventDecoder encoding.Decoder) (err error) {
	for err == nil {
		select {
		case <-ctx.Done():
			err = ctx.Err()
			return
		default:
		}

		var e scheduler.Event
		if err = eventDecoder.Decode(&e); err != nil {
			return
		}

		err = config.handler.HandleEvent(ctx, &e)
	}
	return
}
1082231
func (c Cap) InteriorIntersects(other Cap) bool {
	// Make sure this cap has an interior and the other cap is non-empty.
	if c.height <= zeroHeight || other.IsEmpty() {
		return false
	}

	return c.Radius()+other.Radius() > c.center.Distance(other.center)
}
1164874
func RegularLoopForFrame(frame matrix3x3, radius s1.Angle, numVertices int) *Loop {
	return LoopFromPoints(regularPointsForFrame(frame, radius, numVertices))
}
850407
func (g *gossipRegistry) eventLoop() {
	for {
		select {
		// return when done
		case <-g.done:
			return
		case ev := <-g.events:
			// TODO: nonblocking update
			g.Lock()
			if _, ok := g.members[ev.node]; ok {
				g.members[ev.node] = ev.action
			}
			g.Unlock()
		}
	}
}
178826
func (t Term) GetIntersecting(args interface{}, optArgs ...GetIntersectingOpts) Term {
	opts := map[string]interface{}{}
	if len(optArgs) >= 1 {
		opts = optArgs[0].toMap()
	}

	return constructMethodTerm(t, "GetIntersecting", p.Term_GET_INTERSECTING, []interface{}{args}, opts)
}
385295
func Slice(elements ...interface{}) AnyIfType {
	return AnyIf(func(argument interface{}) bool {
		var v = reflect.ValueOf(argument)

		if v.Kind() != reflect.Slice {
			return false
		}

		var el, al = len(elements), v.Len()

		if el == 0 {
			return al == 0
		}

		if elements[el-1] == Rest {
			el--

			if al < el {
				return false
			}
		} else if al != el {
			return false
		}

		for i := 0; i < el; i++ {
			if !match(v.Index(i).Interface(), elements[i]) {
				return false
			}
		}

		return true
	})
}