internal/unsafe: get rid of SliceOf

Move SliceOf to the package of the only user and unexport it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-11 11:20:07 +01:00
parent 5894127204
commit 86f10e33d7
2 changed files with 12 additions and 15 deletions
-13
View File
@@ -31,16 +31,3 @@ func BytesView(s interface{}) []byte {
h.Len = v.Len() * sz
return res
}
// SliceOf returns a slice from a (native) pointer.
func SliceOf(s uintptr) []byte {
if s == 0 {
return nil
}
var res []byte
h := (*reflect.SliceHeader)(unsafe.Pointer(&res))
h.Data = s
h.Cap = 1 << 30
h.Len = 1 << 30
return res
}