github.com/trim21/go-phpserialize@v0.0.22-0.20240301204449-2fca0319b3f0/internal/encoder/unsafe.go (about)

     1  package encoder
     2  
     3  import (
     4  	"unsafe"
     5  
     6  	"github.com/trim21/go-phpserialize/internal/runtime"
     7  )
     8  
     9  func PtrDeRef(p uintptr) uintptr {
    10  	return **(**uintptr)(unsafe.Pointer(&p))
    11  }
    12  
    13  func ptrToUnsafePtr(p uintptr) unsafe.Pointer {
    14  	return *(*unsafe.Pointer)(unsafe.Pointer(&p))
    15  }
    16  
    17  type emptyInterface struct {
    18  	typ *runtime.Type  // value type
    19  	ptr unsafe.Pointer // value address
    20  }