mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
Update memory.go
This commit is contained in:
parent
c51e1b54a5
commit
a688be7baf
1 changed files with 4 additions and 4 deletions
|
|
@ -77,13 +77,13 @@ func (m *Memory) Set32(offset uint64, val *uint256.Int) {
|
||||||
val.PutUint256(m.store[offset:])
|
val.PutUint256(m.store[offset:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize resizes the memory to size
|
// Resize grows the memory to the requested size.
|
||||||
func (m *Memory) Resize(size uint64) {
|
func (m *Memory) Resize(size uint64) {
|
||||||
if uint64(m.Len()) < size {
|
if uint64(len(m.store)) < size {
|
||||||
if uint64(cap(m.store)) > size {
|
if uint64(cap(m.store)) >= size {
|
||||||
m.store = m.store[:size]
|
m.store = m.store[:size]
|
||||||
} else {
|
} else {
|
||||||
m.store = append(m.store, make([]byte, size-uint64(m.Len()))...)
|
m.store = append(m.store, make([]byte, size-uint64(len(m.store)))...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue