mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
core/vm: optimize Memory.Set32 (#24847)
* core/vm: remove unnecessary memset for Memory.Set32 * core/vm: optimize Memory.Set32
This commit is contained in:
parent
f5ff022dbc
commit
e0a1fd5fdc
@ -53,10 +53,9 @@ func (m *Memory) Set32(offset uint64, val *uint256.Int) {
|
||||
if offset+32 > uint64(len(m.store)) {
|
||||
panic("invalid memory: store empty")
|
||||
}
|
||||
// Zero the memory area
|
||||
copy(m.store[offset:offset+32], []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
|
||||
// Fill in relevant bits
|
||||
val.WriteToSlice(m.store[offset:])
|
||||
b32 := val.Bytes32()
|
||||
copy(m.store[offset:], b32[:])
|
||||
}
|
||||
|
||||
// Resize resizes the memory to size
|
||||
|
Loading…
Reference in New Issue
Block a user