diff --git a/writer_tinygo.go b/writer_tinygo.go new file mode 100644 index 0000000..3b06e99 --- /dev/null +++ b/writer_tinygo.go @@ -0,0 +1,18 @@ +// +build tinygo + +package fwd + +import ( + "reflect" + "unsafe" +) + +// unsafe cast string as []byte +func unsafestr(b string) []byte { + l := uintptr(len(b)) + return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ + Len: l, + Cap: l, + Data: (*reflect.StringHeader)(unsafe.Pointer(&b)).Data, + })) +} diff --git a/writer_unsafe.go b/writer_unsafe.go index a0bf453..1701572 100644 --- a/writer_unsafe.go +++ b/writer_unsafe.go @@ -1,4 +1,4 @@ -// +build !appengine +// +build !appengine,!tinygo package fwd