diff options
Diffstat (limited to 'libgo/go/runtime/string.go')
-rw-r--r-- | libgo/go/runtime/string.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libgo/go/runtime/string.go b/libgo/go/runtime/string.go index 5df3aa3904d..bf5791e06ff 100644 --- a/libgo/go/runtime/string.go +++ b/libgo/go/runtime/string.go @@ -444,3 +444,20 @@ func gostringw(strw *uint16) string { b[n2] = 0 // for luck return s[:n2] } + +// These two functions are called by code generated by cgo -gccgo. + +//go:linkname __go_byte_array_to_string __go_byte_array_to_string +func __go_byte_array_to_string(p unsafe.Pointer, l int) string { + if l == 0 { + return "" + } + s, c := rawstringtmp(nil, l) + memmove(unsafe.Pointer(&c[0]), p, uintptr(l)) + return s +} + +//go:linkname __go_string_to_byte_array __go_string_to_byte_array +func __go_string_to_byte_array(s string) []byte { + return stringtoslicebyte(nil, s) +} |