// TryToInt64Slice casts an empty interface to []int64.
971367
func TryToInt64Slice(i interface{}) (r []int64, err error) {
	switch v := i.(type) {
	case []int:
		r = make([]int64, len(v))
		for index, value := range v {
			r[index] = int64(value)
		}
	case []int32:
		r = make([]int64, len(v))
		for index, value := range v {
			r[index] = int64(value)
		}
	case []int64:
		r = v
	case *[]int64:
		r = *v
	case []string:
		r = make([]int64, len(v))
		for index, value := range v {
			r[index], err = TryToInt64(value)
			if err != nil {
				return
			}
		}
	default:
		err = castError(i, "[]int64")
	}
	return
}
597933
func InStringSlice(sl []string, val string) bool {
	for _, s := range sl {
		if s == val {
			return true
		}
	}

	return false
}
366975
func ToInt64E(in interface{}) (int64, error) {
	switch s := in.(type) {
	case int:
		return int64(s), nil
	case int64:
		return s, nil
	case int32:
		return int64(s), nil
	case int16:
		return int64(s), nil
	case int8:
		return int64(s), nil
	case string:
		v, err := strconv.ParseInt(s, 0, 64)
		if err != nil {
			return 0, fmt.Errorf("unable to Cast %#v to int", in)
		}
		return v, nil
	case float64:
		return int64(s), nil
	case bool:
		if bool(s) {
			return 1, nil
		}
		return 0, nil
	case nil:
		return 0, nil
	default:
		return 0, fmt.Errorf("unable to Cast %#v to int", in)
	}
}
1336403
func StringToInt64Slice(s, sep string) []int64 {
	if s == "" {
		return nil
	}

	fields := strings.Split(s, sep)
	slice := make([]int64, len(fields))
	for i, f := range fields {
		slice[i] = ToInt64(f)
	}
	return slice
}
136493
func (p *PortList) PopIntSlice(num int) []int {
	ports := make([]int, num)
	for i := range ports {
		ports[i] = p.PopInt()
	}
	return ports
}
1223232
func (c *Context) IntSlice(name string) []int {
	return lookupIntSlice(name, c.flagSet)
}
579051
func _int64(i interface{}) (int64, bool) {

	switch v := i.(type) {

	case int:
		return int64(v), true
	case int8:
		return int64(v), true
	case int16:
		return int64(v), true
	case int32:
		return int64(v), true
	case int64:
		return v, true
	case uint:
		return int64(v), true
	case uint8:
		return int64(v), true
	case uint16:
		return int64(v), true
	case uint32:
		return int64(v), true
	case uint64:
		return int64(v), true
	}

	return 0, false
}
480104
func TryToUint8(i interface{}) (r uint8, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case uint:
		r = uint8(t)
	case uint8:
		r = t
	case *uint8:
		r = *t
	case uint16:
		r = uint8(t)
	case uint32:
		r = uint8(t)
	case uint64:
		r = uint8(t)
	case int:
		r = uint8(t)
	case int8:
		r = uint8(t)
	case int16:
		r = uint8(t)
	case int32:
		r = uint8(t)
	case int64:
		r = uint8(t)
	case float32:
		r = uint8(t)
	case float64:
		r = uint8(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		var v uint64
		if v, err = strconv.ParseUint(t, 10, 8); err == nil {
			r = uint8(v)
		}
	default:
		err = castError(i, "uint8")
	}
	return
}
498806
func InStringSlice(slice []string, src string) bool {
	for _, s := range slice {
		if s == src {
			return true
		}
	}

	return false
}
1007093
func TryToUint32(i interface{}) (r uint32, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case uint:
		r = uint32(t)
	case uint8:
		r = uint32(t)
	case uint16:
		r = uint32(t)
	case uint32:
		r = t
	case *uint32:
		r = *t
	case uint64:
		r = uint32(t)
	case int:
		r = uint32(t)
	case int8:
		r = uint32(t)
	case int16:
		r = uint32(t)
	case int32:
		r = uint32(t)
	case int64:
		r = uint32(t)
	case float32:
		r = uint32(t)
	case float64:
		r = uint32(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		var v uint64
		if v, err = strconv.ParseUint(t, 10, 32); err == nil {
			r = uint32(v)
		}
	default:
		err = castError(i, "uint32")
	}
	return
}
832690
func TryToUint16(i interface{}) (r uint16, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case uint:
		r = uint16(t)
	case uint8:
		r = uint16(t)
	case uint16:
		r = t
	case *uint16:
		r = *t
	case uint32:
		r = uint16(t)
	case uint64:
		r = uint16(t)
	case int:
		r = uint16(t)
	case int8:
		r = uint16(t)
	case int16:
		r = uint16(t)
	case int32:
		r = uint16(t)
	case int64:
		r = uint16(t)
	case float32:
		r = uint16(t)
	case float64:
		r = uint16(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		var v uint64
		if v, err = strconv.ParseUint(t, 10, 16); err == nil {
			r = uint16(v)
		}
	default:
		err = castError(i, "uint16")
	}
	return
}
1304584
func valToInt64(i interface{}) (int64, bool) {
	switch x := i.(type) {
	case float32:
		return int64(x), true
	case float64:
		return int64(x), true
	case uint8:
		return int64(x), true
	case uint16:
		return int64(x), true
	case uint32:
		return int64(x), true
	case uint64:
		if x > math.MaxInt64 {
			return 0, false
		}
		return int64(x), true
	case int8:
		return int64(x), true
	case int16:
		return int64(x), true
	case int32:
		return int64(x), true
	case int64:
		return int64(x), true
	case int:
		return int64(x), true
	case uint:
		if uint64(x) > math.MaxInt64 {
			return 0, false
		}
		return int64(x), true
	case string:
		if len(x) > 0 {
			if iv, err := strconv.ParseInt(x, 10, 64); err == nil {
				return iv, true
			}
			if iv, err := strconv.ParseFloat(x, 64); err == nil {
				return valToInt64(iv)
			}
		}
	case []byte:
		if len(x) > 0 {
			if iv, err := strconv.ParseInt(string(x), 10, 64); err == nil {
				return iv, true
			}
			if iv, err := strconv.ParseFloat(string(x), 64); err == nil {
				return valToInt64(iv)
			}
		}
	case json.RawMessage:
		if len(x) > 0 {
			if iv, err := strconv.ParseInt(string(x), 10, 64); err == nil {
				return iv, true
			}
			if iv, err := strconv.ParseFloat(string(x), 64); err == nil {
				return valToInt64(iv)
			}
		}
	}
	return 0, false
}
808885
func (c *Context) GlobalIntSlice(name string) []int {
	if fs := lookupGlobalFlagSet(name, c); fs != nil {
		return lookupIntSlice(name, fs)
	}
	return nil
}
1065599
func Int64Slice(v []int64) []*int64 {
	out := make([]*int64, len(v))
	for i := range v {
		out[i] = &v[i]
	}
	return out
}
1227676
func (w *ByteWriter) WriteInt64(val int64, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
92228
func (k *Key) ValidInt64s(delim string) []int64 {
	vals, _ := k.parseInt64s(k.Strings(delim), false, false)
	return vals
}
191665
func Float64Slice(v []float64) []*float64 {
	out := make([]*float64, len(v))
	for i := range v {
		out[i] = &v[i]
	}
	return out
}