mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
20 lines
253 B
Go
20 lines
253 B
Go
|
package cutils
|
||
|
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
func ByteSlice(pointer unsafe.Pointer, size int) []byte {
|
||
|
var s []byte
|
||
|
|
||
|
h := (*reflect.SliceHeader)((unsafe.Pointer(&s)))
|
||
|
h.Cap = size
|
||
|
h.Len = size
|
||
|
h.Data = uintptr(pointer)
|
||
|
|
||
|
return s
|
||
|
}
|