// IntSlice defines a []int flag with specified name, default value, and usage
// string. The return value is the address of a []int variable that stores
// the value of the flag.
420681
func IntSlice(value []int, name, usage string) *[]int {
	p := new([]int)
	flag.Var(NewIntSlice(value, p), name, usage)
	return p
}
1189422
func ByteSliceToUint64Slice(in []byte) ([]uint64, error) {
	buffer := bytes.NewBuffer(in)

	out := make([]uint64, len(in)/8)
	err := binary.Read(buffer, STORE_ENDIAN, &out)
	if err != nil {
		return nil, err
	}
	return out, nil
}
412935
func (set IdentifierSet) ToSlice() []Identifier {
	var s []Identifier
	for v := range set {
		s = append(s, v)
	}
	return s
}
794274
func IntSlice(src []int) []*int {
	dst := make([]*int, len(src))
	for i := 0; i < len(src); i++ {
		dst[i] = &(src[i])
	}
	return dst
}
948240
func ToIntSliceE(i interface{}) ([]int, error) {
	if i == nil {
		return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
	}

	switch v := i.(type) {
	case []int:
		return v, nil
	}

	kind := reflect.TypeOf(i).Kind()
	switch kind {
	case reflect.Slice, reflect.Array:
		s := reflect.ValueOf(i)
		a := make([]int, s.Len())
		for j := 0; j < s.Len(); j++ {
			val, err := ToIntE(s.Index(j).Interface())
			if err != nil {
				return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
			}
			a[j] = val
		}
		return a, nil
	default:
		return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
	}
}
604542
func IntSliceVar(p *[]int, value []int, name, usage string) {
	flag.Var(NewIntSlice(value, p), name, usage)
}
902102
func Int32Slice(src []int32) []*int32 {
	dst := make([]*int32, len(src))
	for i := 0; i < len(src); i++ {
		dst[i] = &(src[i])
	}
	return dst
}
368541
func copySlice(slice []byte) []byte {
	ret := make([]byte, len(slice))
	copy(ret, slice)
	return ret
}
446200
func (d *defaulter) AsStringSlice(v Valuer, sep string, dv []string) []string {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	return strings.Split(value, sep)
}
344646
func (mmap MarshalMap) Int64Slice(key string) ([]int64, error) {
	return mmap.Int64Array(key)
}
78726
func SumIntSlice(slice []int) int {
	sum := 0
	for _, val := range slice {
		sum += val
	}
	return sum
}
812758
func Int64Slice(val, sep string) ([]int64, error) {
	s := strings.Split(val, sep)
	values := make([]int64, len(s))
	for i, v := range s {
		value, err := Int64(v)
		if err != nil {
			return values, err
		}
		values[i] = value
	}
	return values, nil
}
1155694
func NewInt64SliceFlag(fl cli.Int64SliceFlag) *Int64SliceFlag {
	return &Int64SliceFlag{Int64SliceFlag: fl, set: nil}
}
861872
func Int32Slice(val, sep string) ([]int32, error) {
	s := strings.Split(val, sep)
	values := make([]int32, len(s))
	for i, v := range s {
		value, err := Int32(v)
		if err != nil {
			return values, err
		}
		values[i] = value
	}
	return values, nil
}
814140
func safeSlice(keyvals []interface{}) []interface{} {
	if len(keyvals) == 0 {
		return nil
	}
	return keyvals[0:len(keyvals):len(keyvals)]
}
1230266
func sortInterfaceSlice(in []interface{}) []interface{} {
	a := []string{}
	b := []interface{}{}
	for _, v := range in {
		a = append(a, v.(string))
	}

	sort.Strings(a)

	for _, v := range a {
		b = append(b, v)
	}

	return b
}
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
}