// resolveInt will resolve an int to one of the 4 compatible types.
164152
func (m MetricType) resolveInt(val interface{}) interface{} {
	if vi, isInt := val.(int); isInt {
		switch m {
		case Int64Type:
			return int64(vi)
		case Uint32Type:
			return uint32(vi)
		case Uint64Type:
			return uint64(vi)
		}
		return int32(val.(int))
	}

	if vui, isUint := val.(uint); isUint {
		if m == Uint64Type {
			return uint64(vui)
		}
		return uint32(vui)
	}

	return val
}
295185
func (c *Context) GlobalInt(name string) int {
	return lookupInt(name, c.globalSet)
}
126913
func (j *JsonQuery) Int(s ...string) (int, error) {
	val, err := rquery(j.blob, s...)
	if err != nil {
		return 0, err
	}
	return intFromInterface(val)
}
377806
func (r *IDResolver) Resolve(ctx context.Context, t interface{}, id string) (string, error) {
	if r.noResolve {
		return id, nil
	}
	if name, ok := r.cache[id]; ok {
		return name, nil
	}
	name, err := r.get(ctx, t, id)
	if err != nil {
		return "", err
	}
	r.cache[id] = name
	return name, nil
}
377542
func (t Result) Int() int64 {
	switch t.Type {
	default:
		return 0
	case True:
		return 1
	case String:
		n, _ := parseInt(t.Str)
		return n
	case Number:
		// try to directly convert the float64 to int64
		n, ok := floatToInt(t.Num)
		if !ok {
			// now try to parse the raw string
			n, ok = parseInt(t.Raw)
			if !ok {
				// fallback to a standard conversion
				return int64(t.Num)
			}
		}
		return n
	}
}
956690
func resolveUID(id string) string {
	_, err := strconv.ParseInt(id, 10, 64)
	if err == nil {
		return id
	}
	// Preserve behavior where unset ID == 0
	if id == "" {
		return "0"
	}
	return fmt.Sprintf(`$(id -u %s)`, id)
}
1355123
func (d *Driver) resolveID(id string) (string, error) {
	content, err := ioutil.ReadFile(filepath.Join(d.dir(id), "layerID"))
	if os.IsNotExist(err) {
		return id, nil
	} else if err != nil {
		return "", err
	}
	return string(content), nil
}
1100154
func resolveType(r ActionInterface) ActionInterface {
	ax, ad := UnwrapAny(r)

	if ax != nil {
		return ax
	}

	if ad != nil {
		xa := NewAction()
		ad.When(func(x interface{}, _ ActionInterface) {
			xa.Fullfill(x)
		})
		return xa
	}

	return r
}
1191711
func (c Config) GetInt(key string) (int64, error) {
	var (
		iout int64
		val  interface{}
		ok   bool
	)

	if val, ok = c[key]; !ok {
		return iout, ErrConfigNotFound
	}

	if iout, ok = val.(int64); !ok {
		return iout, ErrNotAnInt
	}

	return iout, nil
}
1171059
func DefaultInt(obj interface{}, defaultValue int) int {
	return int(DefaultInt64(obj, int64(defaultValue)))
}
1315994
func (r *resolver) Resolve(it *config.Config) error {
	return r.resolveItem(r.single, it.Content, it.FormatSpec.Formatter)
}
1124040
func (r *Resolver) Resolve(qname, qtype string) RRs {
	rrs, err := r.ResolveErr(qname, qtype)
	if err == NXDOMAIN {
		return emptyRRs
	}
	if err != nil {
		return nil
	}
	return rrs
}
640745
func (c *Config) ReadInt(id string) (int, error) {
	val, ok := c.Options[id]
	if !ok {
		return 0, fmt.Errorf("Specified config is missing from options")
	}
	ival, err := strconv.Atoi(val)
	if err != nil {
		return 0, fmt.Errorf("Failed to parse %s as int: %s", val, err)
	}
	return ival, nil
}
1327687
func (c *IniConfigContainer) Int(key string) (int, error) {
	return strconv.Atoi(c.getdata(key))
}
807568
func (dec *Decoder) Int(v *int) error {
	err := dec.decodeInt(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
241046
func (v Value) Int() (int, error) {
	i, err := strconv.Atoi(v.String())
	if err != nil {
		return 0, v.invalidTypeError(err, "int")
	}
	return i, nil
}
1072180
func (g *graph) ResolveAll() []reflect.Value {
	var values []reflect.Value
	for _, def := range g.definitions {
		values = append(values, def.Resolve(g))
	}
	return values
}