compiler: add support for new unsafe slice/string functions

This adds support for unsafe.SliceData, unsafe.String, and
unsafe.SringData that were introduced in Go 1.20.
This commit is contained in:
Ayke van Laethem
2023-01-13 17:52:18 +00:00
committed by Ron Evans
parent 33489d6344
commit c43958972c
6 changed files with 120 additions and 21 deletions
+15
View File
@@ -0,0 +1,15 @@
package main
import "unsafe"
func unsafeSliceData(s []int) *int {
return unsafe.SliceData(s)
}
func unsafeString(ptr *byte, len int16) string {
return unsafe.String(ptr, len)
}
func unsafeStringData(s string) *byte {
return unsafe.StringData(s)
}