mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
22 lines
423 B
Go
22 lines
423 B
Go
//go:build !appengine && !appenginevm
|
|
// +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))
|
|
}
|