0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-30 08:44:32 +01:00
gitea/vendor/github.com/philhofer/fwd/writer_unsafe.go

19 lines
290 B
Go
Raw Normal View History

2018-05-19 14:49:46 +02:00
// +build !appengine
package fwd
import (
"reflect"
"unsafe"
)
// unsafe cast string as []byte
func unsafestr(b string) []byte {
l := len(b)
return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
Len: l,
Cap: l,
Data: (*reflect.StringHeader)(unsafe.Pointer(&b)).Data,
}))
}