From 50d507f366c2bb94407c650780f84f424b40eaf7 Mon Sep 17 00:00:00 2001 From: mido Date: Tue, 6 Aug 2024 08:45:15 -0700 Subject: [PATCH] upgrade unsafeGetBytes to use unsafe.slice --- compiler.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler.go b/compiler.go index 21aa538..c066589 100644 --- a/compiler.go +++ b/compiler.go @@ -1097,7 +1097,5 @@ func unsafeGetBytes(s string) []byte { if s == "" { return []byte{} } - return (*[0x7fff0000]byte)(unsafe.Pointer( - (*reflect.StringHeader)(unsafe.Pointer(&s)).Data), - )[:len(s):len(s)] + return unsafe.Slice(unsafe.StringData(s), len(s)) }