diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-04 17:53:49 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-04 17:53:49 +0800 |
commit | 83663ed4b01480c628ce2c849e4e881ac04b5120 (patch) | |
tree | 0bbef8acd355038c39b754aeb3d615e47257686e /vm/closure.go | |
parent | 9008b155d3c8d2a32c4c8945f1174243d48d4e90 (diff) | |
download | dexon-83663ed4b01480c628ce2c849e4e881ac04b5120.tar.gz dexon-83663ed4b01480c628ce2c849e4e881ac04b5120.tar.zst dexon-83663ed4b01480c628ce2c849e4e881ac04b5120.zip |
Renames for chain, updated VM, moved methods
* Renamed a couple more chain => core
* Updated VM `pc` to be uint64 rather than big int
* XEth interface cleanup
Diffstat (limited to 'vm/closure.go')
-rw-r--r-- | vm/closure.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vm/closure.go b/vm/closure.go index 5324ee1ec..bd5268f96 100644 --- a/vm/closure.go +++ b/vm/closure.go @@ -41,16 +41,16 @@ func NewClosure(msg *state.Message, caller ClosureRef, object ClosureRef, code [ return c } -func (c *Closure) GetValue(x *big.Int) *ethutil.Value { - return c.GetRangeValue(x, big.NewInt(1)) +func (c *Closure) GetValue(x uint64) *ethutil.Value { + return c.GetRangeValue(x, 1) } -func (c *Closure) GetOp(x int) OpCode { +func (c *Closure) GetOp(x uint64) OpCode { return OpCode(c.GetByte(x)) } -func (c *Closure) GetByte(x int) byte { - if x > -1 && x < len(c.Code) { +func (c *Closure) GetByte(x uint64) byte { + if x < uint64(len(c.Code)) { return c.Code[x] } @@ -65,12 +65,12 @@ func (c *Closure) GetBytes(x, y int) []byte { return c.Code[x : x+y] } -func (c *Closure) GetRangeValue(x, y *big.Int) *ethutil.Value { - if x.Int64() >= int64(len(c.Code)) || y.Int64() >= int64(len(c.Code)) { +func (c *Closure) GetRangeValue(x, y uint64) *ethutil.Value { + if x >= uint64(len(c.Code)) || y >= uint64(len(c.Code)) { return ethutil.NewValue(0) } - partial := c.Code[x.Int64() : x.Int64()+y.Int64()] + partial := c.Code[x : x+y] return ethutil.NewValue(partial) } |