mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
drop wrong and not-required bound check
This commit is contained in:
parent
0ddfe7a9d1
commit
0265e9b6c0
1 changed files with 5 additions and 10 deletions
|
|
@ -71,11 +71,9 @@ func (m *Memory) GetCopy(offset, size uint64) (cpy []byte) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if uint64(len(m.store)) > offset {
|
// memory is always resized before being accessed, no need to check bounds
|
||||||
cpy = make([]byte, size)
|
cpy = make([]byte, size)
|
||||||
copy(cpy, m.store[offset:offset+size])
|
copy(cpy, m.store[offset:offset+size])
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,13 +83,10 @@ func (m *Memory) GetPtr(offset, size uint64) []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if uint64(len(m.store)) > offset {
|
// memory is always resized before being accessed, no need to check bounds
|
||||||
return m.store[offset : offset+size]
|
return m.store[offset : offset+size]
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Len returns the length of the backing slice
|
// Len returns the length of the backing slice
|
||||||
func (m *Memory) Len() int {
|
func (m *Memory) Len() int {
|
||||||
return len(m.store)
|
return len(m.store)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue