diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-13 20:44:15 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-13 20:44:15 +0800 |
commit | f76cc6699ecd995d78cfd980b229473101191137 (patch) | |
tree | d91ea0c1725b080062cb6eb2b294e61af02cacc2 /vm/common.go | |
parent | 80592f244da3f7323b7fa3e75a17c8e37c97fe8d (diff) | |
download | dexon-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.go | 8 |
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)) +} |