Skip to content

Commit

Permalink
Enable unsafe.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Sep 4, 2015
1 parent bd58c2d commit a689c20
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

package redis

import (
"reflect"
"unsafe"
)

func bytesToString(b []byte) string {
return string(b)
bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b))
strHeader := reflect.StringHeader{bytesHeader.Data, bytesHeader.Len}
return *(*string)(unsafe.Pointer(&strHeader))
}

0 comments on commit a689c20

Please sign in to comment.