diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-19 23:26:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-20 06:21:23 +0800 |
commit | f5af1fdca8dc7d44b4c2025195c19819886729b6 (patch) | |
tree | 2e8749dd034b7b09655001894e6e9bd755d1b49e /core/vm/memory.go | |
parent | 648b352424e70f099f62cc18a768babb90434350 (diff) | |
download | go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar.gz go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar.bz2 go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar.lz go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar.xz go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.tar.zst go-tangerine-f5af1fdca8dc7d44b4c2025195c19819886729b6.zip |
core/vm: RETURN op code returns pointer to memory rather than copy
Diffstat (limited to 'core/vm/memory.go')
-rw-r--r-- | core/vm/memory.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/vm/memory.go b/core/vm/memory.go index b77d486eb..d20aa9591 100644 --- a/core/vm/memory.go +++ b/core/vm/memory.go @@ -49,6 +49,18 @@ func (self *Memory) Get(offset, size int64) (cpy []byte) { return } +func (self *Memory) GetPtr(offset, size int64) []byte { + if size == 0 { + return nil + } + + if len(self.store) > int(offset) { + return self.store[offset : offset+size] + } + + return nil +} + func (m *Memory) Len() int { return len(m.store) } |