aboutsummaryrefslogtreecommitdiffstats
path: root/vm/stack.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-27 18:44:16 +0800
committerobscuren <geffobscura@gmail.com>2014-10-27 18:44:16 +0800
commit272d58662c885ab1cef8930e96fb832ae5377d96 (patch)
treee040eaec5c7e895dd6aaadedbbe30054aaa5e805 /vm/stack.go
parent6623500c6b2e5fe9fa41a1ce75269955af6026e8 (diff)
downloaddexon-272d58662c885ab1cef8930e96fb832ae5377d96.tar.gz
dexon-272d58662c885ab1cef8930e96fb832ae5377d96.tar.zst
dexon-272d58662c885ab1cef8930e96fb832ae5377d96.zip
Implemented LOG. Closes #159
Diffstat (limited to 'vm/stack.go')
-rw-r--r--vm/stack.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vm/stack.go b/vm/stack.go
index 55fdb6d15..69ded6562 100644
--- a/vm/stack.go
+++ b/vm/stack.go
@@ -139,6 +139,18 @@ func (m *Memory) Get(offset, size int64) []byte {
return nil
}
+func (self *Memory) Geti(offset, size int64) (cpy []byte) {
+ if len(self.store) > int(offset) {
+ s := int64(math.Min(float64(len(self.store)), float64(offset+size)))
+ cpy = make([]byte, size)
+ copy(cpy, self.store[offset:offset+s])
+
+ return
+ }
+
+ return
+}
+
func (m *Memory) Len() int {
return len(m.store)
}