diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-20 21:01:35 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-20 21:01:35 +0800 |
commit | 28ddc16a9b5779b6b31036e8248ed8457de7b443 (patch) | |
tree | 7508db500151bdaf0ebed726286f823e67993103 /vm/common.go | |
parent | c161d73d429ef421cdb9c75b743c16d72aa8a89a (diff) | |
parent | 01ff0b3176e6d83dcc5e6716f04301de71e3fc9e (diff) | |
download | dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.gz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.bz2 dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.lz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.xz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.zst dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.zip |
Merge remote-tracking branch 'ethereum/conversion' into conversion
Diffstat (limited to 'vm/common.go')
-rw-r--r-- | vm/common.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vm/common.go b/vm/common.go index 5441a4ac5..8d8f4253f 100644 --- a/vm/common.go +++ b/vm/common.go @@ -73,9 +73,10 @@ func toValue(val *big.Int) interface{} { return val } -func getData(data []byte, start, size uint64) []byte { - x := uint64(math.Min(float64(start), float64(len(data)))) - y := uint64(math.Min(float64(x+size), float64(len(data)))) +func getData(data []byte, start, size *big.Int) []byte { + dlen := big.NewInt(int64(len(data))) - return common.RightPadBytes(data[x:y], int(size)) + s := common.BigMin(start, dlen) + e := common.BigMin(new(big.Int).Add(s, size), dlen) + return common.RightPadBytes(data[s.Uint64():e.Uint64()], int(size.Uint64())) } |