blob: 9f2e418f7901993bcd990d1e62523eebee018440 [file] [log] [blame]
Abhay Kumar40252eb2025-10-13 13:25:53 +00001//go:build !appengine
serkant.uluderyae5afeff2021-02-23 18:00:23 +03002// +build !appengine
3
4package internal
5
6import "unsafe"
7
8// String converts byte slice to string.
9func String(b []byte) string {
10 return *(*string)(unsafe.Pointer(&b))
11}
12
13// Bytes converts string to byte slice.
14func Bytes(s string) []byte {
15 return *(*[]byte)(unsafe.Pointer(
16 &struct {
17 string
18 Cap int
19 }{s, len(s)},
20 ))
21}