// removeFactors divides in a loop; the return values have the property that
// d == result * factor ^ times
// d may be modified in place.
// If d == 0, then the return values will be (0, 0)
435312
func removeFactors(d, factor *big.Int) (result *big.Int, times int) {
	q := big.NewInt(0)
	m := big.NewInt(0)
	for d.Cmp(bigZero) != 0 {
		q.DivMod(d, factor, m)
		if m.Cmp(bigZero) != 0 {
			break
		}
		times++
		d, q = q, d
	}
	return d, times
}
1308521
func RemoveMapFields(config, live map[string]interface{}) map[string]interface{} {
	result := map[string]interface{}{}
	for k, v1 := range config {
		v2, ok := live[k]
		if !ok {
			continue
		}
		if v2 != nil {
			v2 = removeFields(v1, v2)
		}
		result[k] = v2
	}
	return result
}
955739
func removeRelations(data [][]string, appName string) [][]string {
	var result [][]string
	for _, relation := range data {
		// Keep the dud relation in the set, it will be caught by the bundle
		// verify code.
		if len(relation) == 2 {
			left, right := relation[0], relation[1]
			if left == appName || strings.HasPrefix(left, appName+":") ||
				right == appName || strings.HasPrefix(right, appName+":") {
				continue
			}
		}
		result = append(result, relation)
	}
	return result
}
160023
func FiltersFromArgs(filterVals []value.Value) []string {
	filters := make([]string, 0, len(filterVals))
	for _, fv := range filterVals {
		switch fv := fv.(type) {
		case value.Slice:
			for _, fv := range fv.SliceValue() {
				matchKey := fv.ToString()
				if strings.Contains(matchKey, "%") {
					matchKey = strings.Replace(matchKey, "%", "*", -1)
				}
				filters = append(filters, matchKey)
			}
		case value.StringValue:
			matchKey := fv.ToString()
			if strings.Contains(matchKey, "%") {
				matchKey = strings.Replace(matchKey, "%", "*", -1)
			}
			filters = append(filters, matchKey)
		}
	}
	return filters
}
1103279
func (hg *Histogram) GetIncreaseFactor(totalCount int64) float64 {
	columnCount := hg.TotalRowCount()
	if columnCount == 0 {
		// avoid dividing by 0
		return 1.0
	}
	return float64(totalCount) / columnCount
}
1021654
func (service *BaseService) RemoveFilter(filter ...Filter) Service {
	service.filterManager.RemoveFilter(filter...)
	return service
}
1243745
func (client *BaseClient) RemoveFilterByIndex(index int) Client {
	client.filterManager.RemoveFilterByIndex(index)
	return client
}
1307408
func (ns nsRefcounts_) RemoveOp(coll mongo.Collection, key string, value int) (txn.Op, error) {
	refcount, err := ns.read(coll, key)
	if err != nil {
		return txn.Op{}, errors.Trace(err)
	}
	if refcount != value {
		logger.Tracef("reference of %s(%q) had %d refs, expected %d", coll.Name(), key, refcount, value)
		return txn.Op{}, errRefcountChanged
	}
	return ns.JustRemoveOp(coll.Name(), key, value), nil
}
742196
func removeConfigUnknowns(cfg map[string]interface{}) {
	for k, v := range cfg {
		switch v := v.(type) {
		case string:
			if v == config.UnknownVariableValue {
				delete(cfg, k)
			}
		case []interface{}:
			for _, i := range v {
				if m, ok := i.(map[string]interface{}); ok {
					removeConfigUnknowns(m)
				}
			}
		case map[string]interface{}:
			removeConfigUnknowns(v)
		}
	}
}
949099
func (s *Selection) RemoveFiltered(selector string) *Selection {
	return s.RemoveMatcher(compileMatcher(selector))
}
920586
func (e *SyncedEnforcer) RemoveFilteredPolicySafe(fieldIndex int, fieldValues ...string) (result bool, err error) {
	e.m.Lock()
	defer e.m.Unlock()
	return e.Enforcer.RemoveFilteredPolicySafe(fieldIndex, fieldValues...)
}
951175
func (g *Group) DefsFunc(f func(*Group)) *Statement {
	s := DefsFunc(f)
	g.items = append(g.items, s)
	return s
}
594072
func (e *Env) RemoveMatch(fn func(k, v string) bool) {
	e.iterate(func(realKey, k, v string) bool {
		if fn(k, v) {
			delete(e.env, realKey)
		}
		return true
	})
}
349428
func diffTagsEFS(oldTags, newTags []*efs.Tag) ([]*efs.Tag, []*efs.Tag) {
	// First, we're creating everything we have
	create := make(map[string]interface{})
	for _, t := range newTags {
		create[*t.Key] = *t.Value
	}

	// Build the list of what to remove
	var remove []*efs.Tag
	for _, t := range oldTags {
		old, ok := create[*t.Key]
		if !ok || old != *t.Value {
			// Delete it!
			remove = append(remove, t)
		}
	}

	return tagsFromMapEFS(create), remove
}
523068
func (br *Bridge) RemoveSlaveIfc(ifc *net.Interface) error {
	if err := netlink.NetworkSetNoMaster(ifc); err != nil {
		return err
	}

	for index, i := range br.slaveIfcs {
		// I could reflect.DeepEqual(), but there is not point to import reflect for one operation
		if i.Name == ifc.Name && bytes.Equal(i.HardwareAddr, ifc.HardwareAddr) {
			br.slaveIfcs = append(br.slaveIfcs[:index], br.slaveIfcs[index+1:]...)
		}
	}

	return nil
}
773065
func RemovePtrFromType(t interface{}) reflect.Type {
	var v reflect.Type
	if rt, isType := t.(reflect.Type); isType {
		v = rt
	} else {
		v = reflect.TypeOf(t)
	}
	for v.Kind() == reflect.Ptr {
		v = v.Elem()
	}
	return v
}
478658
func (b *UpdateBuilder) RemoveFunc(column string, fn *Func) *UpdateBuilder {
	return b.removeValue(column, fn)
}