// ArrayToCFArray will return a CFArrayRef and if non-nil, must be released with
// Release(ref).
493506
func ArrayToCFArray(a []C.CFTypeRef) C.CFArrayRef {
	var values []C.uintptr_t
	for _, value := range a {
		values = append(values, C.uintptr_t(value))
	}
	numValues := len(values)
	var valuesPointer *C.uintptr_t
	if numValues > 0 {
		valuesPointer = &values[0]
	}
	return C.CFArrayCreateSafe2(C.kCFAllocatorDefault, valuesPointer, C.CFIndex(numValues), &C.kCFTypeArrayCallBacks)
}
885277
func int8ArrayToByteArray(in []int8) []byte {
	bts := make([]byte, len(in))
	for i, c := range in {
		bts[i] = byte(c)
	}
	return bytes.Trim(bts, "\x00")
}
400314
func (f *Field) FlashArray() []string {
	v := f.Flash()
	if v == "" {
		return []string{}
	}
	return strings.Split(v, ",")
}
1057006
func (w *Writer) WriteArray(count int) {
	w.b = AppendArray(w.b, count)
}
563152
func mapToArray(m stringmapflag.Value) []*swarming.SwarmingRpcsStringPair {
	a := make([]*swarming.SwarmingRpcsStringPair, 0, len(m))
	for k, v := range m {
		a = append(a, &swarming.SwarmingRpcsStringPair{Key: k, Value: v})
	}

	sort.Sort(array(a))
	return a
}
598804
func shallowSizeOfArray(arr interface{}) int64 {
	size := int64(NUM_BYTES_ARRAY_HEADER)
	v := reflect.ValueOf(arr)
	if length := v.Len(); length > 0 {
		switch v.Kind() {
		case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16,
			reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8,
			reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32,
			reflect.Float64, reflect.Complex64, reflect.Complex128:
			// primitive type
			size += int64(length) * int64(v.Elem().Type().Size())
		default:
			size += int64(length * NUM_BYTES_OBJECT_REF)
		}
	}
	return AlignObjectSize(size)
}
1241201
func readArray(rd *bufio.Reader) ([]string, error) {
	line, err := rd.ReadString('\n')
	if err != nil {
		return nil, err
	}
	if len(line) < 3 {
		return nil, ErrProtocol
	}

	switch line[0] {
	default:
		return nil, ErrProtocol
	case '*':
		l, err := strconv.Atoi(line[1 : len(line)-2])
		if err != nil {
			return nil, err
		}
		// l can be -1
		var fields []string
		for ; l > 0; l-- {
			s, err := readString(rd)
			if err != nil {
				return nil, err
			}
			fields = append(fields, s)
		}
		return fields, nil
	}
}
524041
func arrayFromScalar(val interface{}, length int) []interface{} {
	ret := make([]interface{}, length)
	for i := range ret {
		ret[i] = val
	}
	return ret
}
1318653
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) {
	em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0)
}
932641
func (enc *Encoder) EncodeArray(v MarshalerJSONArray) error {
	if enc.isPooled == 1 {
		panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder"))
	}
	_, _ = enc.encodeArray(v)
	_, err := enc.Write()
	if err != nil {
		enc.err = err
		return err
	}
	return nil
}
1134924
func (ua *Uint64Array) Uint64ArrayOr(or []uint64) []uint64 {
	switch {
	case ua == nil:
		return or
	case !ua.Valid:
		return or
	default:
		return ua.Uint64Array
	}
}
63209
func (c *Context) QueryArray(key string) []string {
	values, _ := c.GetQueryArray(key)
	return values
}
652153
func Float64Array(name string, values []float64) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeDouble, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeUint64(math.Float64bits(v))
		}
	}
}
506814
func (d *Drain) ArrayArray(ps ProxySet) [][]interface{} {
	v, err := ps.ArrayArray()
	d.put(err)
	return v
}
1221815
func safeArrayDestroyDescriptor(safearray *SafeArray) (err error) {
	err = convertHresultToError(procSafeArrayDestroyDescriptor.Call(uintptr(unsafe.Pointer(safearray))))
	return
}
549895
func PrintArray(m interface{}) string {
	var outputText string

	switch reflect.TypeOf(m).Kind() {
	case reflect.Slice:
		var xs []string

		slice := reflect.ValueOf(m)
		for i := 0; i < slice.Len(); i++ {
			xs = append(xs, fmt.Sprintf("[%d]=%s", i, slice.Index(i)))
		}

		if len(xs) == 0 {
			outputText = "len(array) == 0"
		} else {
			outputText = strings.Join(xs, "\n")
		}
	default:
		outputText = fmt.Sprintf("error while printing array\nreceived a %T\n  %s\n", m, m)
	}

	return outputText
}
255264
func (ua *Uint32Array) Uint32ArrayOr(or []uint32) []uint32 {
	switch {
	case ua == nil:
		return or
	case !ua.Valid:
		return or
	default:
		return ua.Uint32Array
	}
}