Skip to content

Commit

Permalink
upgrade unsafeGetBytes to use unsafe.slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Mido-sys committed Aug 6, 2024
1 parent 3611e91 commit 50d507f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 50d507f

Please sign in to comment.