Skip to content

Commit

Permalink
rlp: using unsafe.Slice instead of SliceHeader (ethereum#29067)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
cuiweixie and fjl authored Mar 5, 2024
1 parent a6d6e8a commit a970295
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions rlp/unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit a970295

Please sign in to comment.