1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-22 10:01:50 +03:00

Merge pull request #163 from go-redis/fix/enable-unsafe

Enable unsafe.
This commit is contained in:
Vladimir Mihailenco
2015-09-04 14:02:29 +03:00

View File

@ -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))
}