MCPcopy
hub / github.com/segmentio/kafka-go / makeArray

Function makeArray

protocol/reflect_unsafe.go:119–128  ·  view source on GitHub ↗
(t reflect.Type, n int)

Source from the content-addressed store, hash-verified

117)
118
119func makeArray(t reflect.Type, n int) array {
120 var elem unsafe.Pointer
121 var size = uintptr(t.Size())
122 if n == 0 {
123 elem = unsafe.Pointer(&emptyArray)
124 } else {
125 elem = unsafe_NewArray(((*iface)(unsafe.Pointer(&t))).ptr, n)
126 }
127 return array{elem: elem, size: size, len: n}
128}
129
130func (a array) index(i int) value {
131 return value{ptr: unsafe.Pointer(uintptr(a.elem) + (uintptr(i) * a.size))}

Callers

nothing calls this directly

Calls 2

unsafe_NewArrayFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected