github.com/zeebo/goof@v0.0.0-20230907150950-e9457bc94477/helpers.go (about)

     1  package goof
     2  
     3  import (
     4  	"unsafe"
     5  )
     6  
     7  func makeInterface(typ, val unsafe.Pointer) interface{} {
     8  	return *(*interface{})(unsafe.Pointer(&[2]unsafe.Pointer{typ, val}))
     9  }
    10  
    11  func dataPtr(val interface{}) unsafe.Pointer {
    12  	return (*[2]unsafe.Pointer)(unsafe.Pointer(&val))[1]
    13  }