Skip to content

Commit

Permalink
tinygo support
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleypeabody authored and philhofer committed Jul 22, 2021
1 parent 9bcb9ca commit 5c56ac6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions writer_tinygo.go
Original file line number Diff line number Diff line change
@@ -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,
}))
}
2 changes: 1 addition & 1 deletion writer_unsafe.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !appengine
// +build !appengine,!tinygo

package fwd

Expand Down

0 comments on commit 5c56ac6

Please sign in to comment.