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
2 people authored and jorgemmsilva committed Jun 17, 2024
1 parent 5c6e991 commit 0f507bd
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 0f507bd

Please sign in to comment.