rlp: using unsafe.Slice instead of SliceHeader (#29067)

Co-authored-by: Felix Lange <fjl@twurst.com>
pull/29038/head
cui 8 months ago committed by GitHub
parent a6d6e8ac41
commit a970295956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      rlp/unsafe.go

@ -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…
Cancel
Save