blob: 4bc79701f4956b54d640e0f0a494cdafeeea2680 [file] [log] [blame]
Mahir Gunyel82f98dd2023-07-24 10:29:49 +03001// +build !appengine
2
3package internal
4
5import "unsafe"
6
7// String converts byte slice to string.
8func String(b []byte) string {
9 return *(*string)(unsafe.Pointer(&b))
10}
11
12// Bytes converts string to byte slice.
13func Bytes(s string) []byte {
14 return *(*[]byte)(unsafe.Pointer(
15 &struct {
16 string
17 Cap int
18 }{s, len(s)},
19 ))
20}