rlp: using unsafe.Slice instead of SliceHeader (#29067)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
a6d6e8ac41
commit
a970295956
@ -26,10 +26,5 @@ import (
|
||||
|
||||
// byteArrayBytes returns a slice of the byte array v.
|
||||
func byteArrayBytes(v reflect.Value, length int) []byte {
|
||||
var s []byte
|
||||
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s))
|
||||
hdr.Data = v.UnsafeAddr()
|
||||
hdr.Cap = length
|
||||
hdr.Len = length
|
||||
return s
|
||||
return unsafe.Slice((*byte)(unsafe.Pointer(v.UnsafeAddr())), length)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user