aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
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))
+}