summaryrefslogtreecommitdiff
path: root/go/vendor/github.com/philhofer/fwd/writer_unsafe.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/vendor/github.com/philhofer/fwd/writer_unsafe.go')
-rw-r--r--go/vendor/github.com/philhofer/fwd/writer_unsafe.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/go/vendor/github.com/philhofer/fwd/writer_unsafe.go b/go/vendor/github.com/philhofer/fwd/writer_unsafe.go
new file mode 100644
index 0000000..a0bf453
--- /dev/null
+++ b/go/vendor/github.com/philhofer/fwd/writer_unsafe.go
@@ -0,0 +1,18 @@
+// +build !appengine
+
+package fwd
+
+import (
+ "reflect"
+ "unsafe"
+)
+
+// unsafe cast string as []byte
+func unsafestr(b string) []byte {
+ l := len(b)
+ return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
+ Len: l,
+ Cap: l,
+ Data: (*reflect.StringHeader)(unsafe.Pointer(&b)).Data,
+ }))
+}