5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 18:40:25 +00:00
matterbridge/vendor/github.com/philhofer/fwd/writer_unsafe.go
2020-10-19 23:40:00 +02:00

19 lines
290 B
Go

// +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,
}))
}