aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-13 20:44:15 +0800
committerobscuren <geffobscura@gmail.com>2015-03-13 20:44:15 +0800
commitf76cc6699ecd995d78cfd980b229473101191137 (patch)
treed91ea0c1725b080062cb6eb2b294e61af02cacc2 /vm/common.go
parent80592f244da3f7323b7fa3e75a17c8e37c97fe8d (diff)
downloaddexon-f76cc6699ecd995d78cfd980b229473101191137.tar
dexon-f76cc6699ecd995d78cfd980b229473101191137.tar.gz
dexon-f76cc6699ecd995d78cfd980b229473101191137.tar.bz2
dexon-f76cc6699ecd995d78cfd980b229473101191137.tar.lz
dexon-f76cc6699ecd995d78cfd980b229473101191137.tar.xz
dexon-f76cc6699ecd995d78cfd980b229473101191137.tar.zst
dexon-f76cc6699ecd995d78cfd980b229473101191137.zip
Changed context and ADDMOD, MULMOD
* Cleaned up VM execution. VM run now takes a context * ADDMOD/MULMOD - removed incorrect cast
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm/common.go b/vm/common.go
index b391bb8c2..1cb549228 100644
--- a/vm/common.go
+++ b/vm/common.go
@@ -1,6 +1,7 @@
package vm
import (
+ "math"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
@@ -117,3 +118,10 @@ func toValue(val *big.Int) interface{} {
return val
}
+
+func getCode(code []byte, start, size uint64) []byte {
+ x := uint64(math.Min(float64(start), float64(len(code))))
+ y := uint64(math.Min(float64(x+size), float64(len(code))))
+
+ return ethutil.RightPadBytes(code[x:y], int(size))
+}