VictoriaMetrics/vendor/github.com/valyala/quicktemplate/util_noappengine.go
2020-11-02 22:01:42 +02:00

21 lines
385 B
Go

// +build !appengine,!appenginevm
package quicktemplate
import (
"reflect"
"unsafe"
)
func unsafeStrToBytes(s string) (b []byte) {
sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bh.Data = sh.Data
bh.Len = sh.Len
bh.Cap = sh.Len
return b
}
func unsafeBytesToStr(z []byte) string {
return *(*string)(unsafe.Pointer(&z))
}