mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
eth/tracers/internal: delete branch check
This commit is contained in:
parent
659342a523
commit
74358c14bc
1 changed files with 6 additions and 16 deletions
|
|
@ -35,7 +35,12 @@ func GetMemoryCopyPadded(m []byte, offset, size int64) ([]byte, error) {
|
|||
}
|
||||
length := int64(len(m))
|
||||
if offset+size < length { // slice fully inside memory
|
||||
return memoryCopy(m, offset, size), nil
|
||||
if size == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
cpy := make([]byte, size)
|
||||
copy(cpy, m[offset:offset+size])
|
||||
return cpy, nil
|
||||
}
|
||||
paddingNeeded := offset + size - length
|
||||
if paddingNeeded > memoryPadLimit {
|
||||
|
|
@ -48,21 +53,6 @@ func GetMemoryCopyPadded(m []byte, offset, size int64) ([]byte, error) {
|
|||
return cpy, nil
|
||||
}
|
||||
|
||||
func memoryCopy(m []byte, offset, size int64) (cpy []byte) {
|
||||
if size == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(m) > int(offset) {
|
||||
cpy = make([]byte, size)
|
||||
copy(cpy, m[offset:offset+size])
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// MemoryPtr returns a pointer to a slice of memory.
|
||||
func MemoryPtr(m []byte, offset, size int64) []byte {
|
||||
if size == 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue