mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
First commit
This commit is contained in:
19
pkg/cutils/byteslice.go
Normal file
19
pkg/cutils/byteslice.go
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user