~ubuntu-branches/debian/sid/golang-github-philhofer-fwd/sid

« back to all changes in this revision

Viewing changes to writer_unsafe.go

  • Committer: Package Import Robot
  • Author(s): Tianon Gravi
  • Date: 2015-10-21 08:52:08 UTC
  • Revision ID: package-import@ubuntu.com-20151021085208-2zd270ln2kd0uxs2
Tags: upstream-0.0~git20151005.0.8fd9a4b
ImportĀ upstreamĀ versionĀ 0.0~git20151005.0.8fd9a4b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// +build !appengine
 
2
 
 
3
package fwd
 
4
 
 
5
import (
 
6
        "reflect"
 
7
        "unsafe"
 
8
)
 
9
 
 
10
// unsafe cast string as []byte
 
11
func unsafestr(b string) []byte {
 
12
        l := len(b)
 
13
        return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
 
14
                Len:  l,
 
15
                Cap:  l,
 
16
                Data: (*reflect.StringHeader)(unsafe.Pointer(&b)).Data,
 
17
        }))
 
18
}