Skip to content

Instantly share code, notes, and snippets.

@BruceChen7
Created December 13, 2022 14:54
Show Gist options
  • Save BruceChen7/ed3d143feac103f3d3bf2e36f0f244c4 to your computer and use it in GitHub Desktop.
Save BruceChen7/ed3d143feac103f3d3bf2e36f0f244c4 to your computer and use it in GitHub Desktop.
#golang#pointer
func (p *page) meta() *meta {
return (*meta)(unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p)))
}
func unsafeAdd(base unsafe.Pointer, offset uintptr) unsafe.Pointer {
return unsafe.Pointer(uintptr(base) + offset)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment