// Superset checks if one set of resources is a superset
// of another. This ignores network resources, and the NetworkIndex
// should be used for that.
// COMPAT(0.10): Remove in 0.10
424878
func (r *Resources) Superset(other *Resources) (bool, string) {
	if r.CPU < other.CPU {
		return false, "cpu"
	}
	if r.MemoryMB < other.MemoryMB {
		return false, "memory"
	}
	if r.DiskMB < other.DiskMB {
		return false, "disk"
	}
	return true, ""
}
948656
func Supernet(ps []Prefix) *Prefix {
	if len(ps) == 0 {
		return nil
	}
	if ps[0].IP.To4() != nil {
		ps = byAddrFamily(ps).newIPv4Prefixes()
	}
	if ps[0].IP.To16() != nil && ps[0].IP.To4() == nil {
		ps = byAddrFamily(ps).newIPv6Prefixes()
	}
	switch len(ps) {
	case 0:
		return nil
	case 1:
		return &ps[0]
	}
	if ps[0].IP.To4() != nil {
		return supernetIPv4(ps)
	}
	if ps[0].IP.To16() != nil && ps[0].IP.To4() == nil {
		return supernetIPv6(ps)
	}
	return nil
}
569395
func byteSliceSubset(a, b []byte) bool {
	for i, el := range b {
		if el != a[i] {
			return false
		}
	}
	
	return true
}
1013770
func (resourceSet ResourceSet) Match(resource string, conditionValues map[string][]string) bool {
	for r := range resourceSet {
		if r.Match(resource, conditionValues) {
			return true
		}
	}

	return false
}
895049
func (db *RedisDB) ssetSet(key string, sset sortedSet) {
	db.keys[key] = "zset"
	db.keyVersion[key]++
	db.sortedsetKeys[key] = sset
}
496110
func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister {
	return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace}
}
1148722
func (i *Interfaces) Set(index int, object *Interface) error {
	if index < 0 || index >= len(i.objects) {
		return errors.New("index out of bounds")
	}
	i.objects[index] = object.object
	return nil
}
86923
func (sh *ChiSquareSignificanceHeuristic) BackgroundIsSuperset(backgroundIsSuperset bool) *ChiSquareSignificanceHeuristic {
	sh.backgroundIsSuperset = &backgroundIsSuperset
	return sh
}
4434
func (t *TxStructure) LSet(key []byte, index int64, value []byte) error {
	if t.readWriter == nil {
		return errWriteOnSnapshot
	}
	metaKey := t.encodeListMetaKey(key)
	meta, err := t.loadListMeta(metaKey)
	if err != nil || meta.IsEmpty() {
		return errors.Trace(err)
	}

	index = adjustIndex(index, meta.LIndex, meta.RIndex)

	if index >= meta.LIndex && index < meta.RIndex {
		return t.readWriter.Set(t.encodeListDataKey(key, index), value)
	}
	return errInvalidListIndex.GenWithStack("invalid list index %d", index)
}
976265
func (a allocSet) nameSet() map[string]struct{} {
	names := make(map[string]struct{}, len(a))
	for _, alloc := range a {
		names[alloc.Name] = struct{}{}
	}
	return names
}
1251070
func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffortRoots []cid.Cid, output chan<- Result) (*cid.Set, error) {
	// KeySet currently implemented in memory, in the future, may be bloom filter or
	// disk backed to conserve memory.
	errors := false
	gcs := cid.NewSet()
	getLinks := func(ctx context.Context, cid cid.Cid) ([]*ipld.Link, error) {
		links, err := ipld.GetLinks(ctx, ng, cid)
		if err != nil {
			errors = true
			select {
			case output <- Result{Error: &CannotFetchLinksError{cid, err}}:
			case <-ctx.Done():
				return nil, ctx.Err()
			}
		}
		return links, nil
	}
	err := Descendants(ctx, getLinks, gcs, pn.RecursiveKeys())
	if err != nil {
		errors = true
		select {
		case output <- Result{Error: err}:
		case <-ctx.Done():
			return nil, ctx.Err()
		}
	}

	bestEffortGetLinks := func(ctx context.Context, cid cid.Cid) ([]*ipld.Link, error) {
		links, err := ipld.GetLinks(ctx, ng, cid)
		if err != nil && err != ipld.ErrNotFound {
			errors = true
			select {
			case output <- Result{Error: &CannotFetchLinksError{cid, err}}:
			case <-ctx.Done():
				return nil, ctx.Err()
			}
		}
		return links, nil
	}
	err = Descendants(ctx, bestEffortGetLinks, gcs, bestEffortRoots)
	if err != nil {
		errors = true
		select {
		case output <- Result{Error: err}:
		case <-ctx.Done():
			return nil, ctx.Err()
		}
	}

	for _, k := range pn.DirectKeys() {
		gcs.Add(k)
	}

	err = Descendants(ctx, getLinks, gcs, pn.InternalPins())
	if err != nil {
		errors = true
		select {
		case output <- Result{Error: err}:
		case <-ctx.Done():
			return nil, ctx.Err()
		}
	}

	if errors {
		return nil, ErrCannotFetchAllLinks
	}

	return gcs, nil
}
702780
func (e Embedded) Set(rel Relation, r *Resource) {
	e[rel] = r
}
10716
func (s Sparse) Unset(i int) {
	ptrKey := int(uint(i) >> ptrShift)
	ptr, ok := s[ptrKey]
	if !ok {
		return
	}
	ptr &^= 1 << (uint(i) & ptrModMask)
	if ptr == 0 {
		delete(s, ptrKey)
	} else {
		s[ptrKey] = ptr
	}
}
1122758
func (s *SetSubnetsInput) SetSubnets(v []*string) *SetSubnetsInput {
	s.Subnets = v
	return s
}
726861
func (c *TwoTier) Set(key string, value []byte) {
	c.second.Set(key, value)
	c.first.Delete(key)
}
529472
func (m *abstractPagedMutable) Set(index, value int64) {
	assert(index >= 0 && index < m.size)
	pageIndex := m.pageIndex(index)
	indexInPage := m.indexInPage(index)
	m.subMutables[pageIndex].Set(indexInPage, value)
}
33219
func (s *Set) Intersect(t *Set) *Set {
	ls, lt := len(s.items), len(t.items)
	if lt < ls {
		s, t = t, s
	}
	res := New(ls)

	var offset int
	var ok bool
	for _, v := range s.items {
		if offset, ok = index(t.items, v, offset); ok {
			res.Add(v)
		}
	}
	return res
}