github.com/nikandfor/tlog@v0.21.5-0.20231108111739-3ef89426a96d/unsafe.go (about) 1 package tlog 2 3 import ( 4 "unsafe" 5 _ "unsafe" 6 7 "github.com/nikandfor/loc" 8 ) 9 10 //go:noescape 11 //go:linkname caller1 runtime.callers 12 func caller1(skip int, pc *loc.PC, len, cap int) int 13 14 // noescape hides a pointer from escape analysis. noescape is 15 // the identity function but escape analysis doesn't think the 16 // output depends on the input. noescape is inlined and currently 17 // compiles down to zero instructions. 18 // USE CAREFULLY! 19 // 20 //go:nosplit 21 func noescape(p unsafe.Pointer) unsafe.Pointer { 22 x := uintptr(p) 23 return unsafe.Pointer(x ^ 0) //nolint:staticcheck 24 }