package bboltimport ()func unsafeAdd( unsafe.Pointer, uintptr) unsafe.Pointer {returnunsafe.Pointer(uintptr() + )}func unsafeIndex( unsafe.Pointer, uintptr, uintptr, int) unsafe.Pointer {returnunsafe.Pointer(uintptr() + + uintptr()*)}func unsafeByteSlice( unsafe.Pointer, uintptr, , int) []byte {// See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices // // This memory is not allocated from C, but it is unmanaged by Go's // garbage collector and should behave similarly, and the compiler // should produce similar code. Note that this conversion allows a // subslice to begin after the base address, with an optional offset, // while the URL above does not cover this case and only slices from // index 0. However, the wiki never says that the address must be to // the beginning of a C allocation (or even that malloc was used at // all), so this is believed to be correct.return (*[maxAllocSize]byte)(unsafeAdd(, ))[::]}// unsafeSlice modifies the data, len, and cap of a slice variable pointed to by// the slice parameter. This helper should be used over other direct// manipulation of reflect.SliceHeader to prevent misuse, namely, converting// from reflect.SliceHeader to a Go slice type.func unsafeSlice(, unsafe.Pointer, int) { := (*reflect.SliceHeader)() .Data = uintptr() .Cap = .Len = }
The pages are generated with Goldsv0.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.