Source File
unsafe_link.go
Belonging Package
github.com/modern-go/reflect2
package reflect2import//go:linkname unsafe_New reflect.unsafe_Newfunc unsafe_New( unsafe.Pointer) unsafe.Pointer//go:linkname typedmemmove reflect.typedmemmovefunc typedmemmove( unsafe.Pointer, , unsafe.Pointer)//go:linkname unsafe_NewArray reflect.unsafe_NewArrayfunc unsafe_NewArray( unsafe.Pointer, int) unsafe.Pointer// typedslicecopy copies a slice of elemType values from src to dst,// returning the number of elements copied.//go:linkname typedslicecopy reflect.typedslicecopy//go:noescapefunc typedslicecopy( unsafe.Pointer, , sliceHeader) int//go:linkname mapassign reflect.mapassign//go:noescapefunc mapassign( unsafe.Pointer, unsafe.Pointer, unsafe.Pointer, unsafe.Pointer)//go:linkname mapaccess reflect.mapaccess//go:noescapefunc mapaccess( unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) ( unsafe.Pointer)//go:noescape//go:linkname mapiternext reflect.mapiternextfunc mapiternext( *hiter)//go:linkname ifaceE2I reflect.ifaceE2Ifunc ifaceE2I( unsafe.Pointer, interface{}, unsafe.Pointer)// A hash iteration structure.// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate// the layout of this structure.type hiter struct {key unsafe.Pointervalue unsafe.Pointert unsafe.Pointerh unsafe.Pointerbuckets unsafe.Pointerbptr unsafe.Pointeroverflow *[]unsafe.Pointeroldoverflow *[]unsafe.PointerstartBucket uintptroffset uint8wrapped boolB uint8i uint8bucket uintptrcheckBucket uintptr}// add returns p+x.//// The whySafe string is ignored, so that the function still inlines// as efficiently as p+x, but all call sites should use the string to// record why the addition is safe, which is to say why the addition// does not cause x to advance to the very end of p's allocation// and therefore point incorrectly at the next block in memory.func add( unsafe.Pointer, uintptr, string) unsafe.Pointer {return unsafe.Pointer(uintptr() + )}// arrayAt returns the i-th element of p,// an array whose elements are eltSize bytes wide.// The array pointed at by p must have at least i+1 elements:// it is invalid (but impossible to check here) to pass i >= len,// because then the result will point outside the array.// whySafe must explain why i < len. (Passing "i < len" is fine;// the benefit is to surface this assumption at the call site.)func arrayAt( unsafe.Pointer, int, uintptr, string) unsafe.Pointer {return add(, uintptr()*, "i < len")}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |