mirror of
https://github.com/redis/go-redis.git
synced 2025-06-06 17:40:59 +03:00
Enable unsafe.
This commit is contained in:
parent
bd58c2dde4
commit
a689c20777
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
package redis
|
package redis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
func bytesToString(b []byte) string {
|
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))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user