diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-27 22:50:44 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-27 22:53:35 +0800 |
commit | 16e52327a4baa5547c38965fce53b3ff40b98173 (patch) | |
tree | 27fb43512c802e2c3c0fe8bd8d97a55aa2499758 /ethchain/stack.go | |
parent | 05d2d8f27d0bea5b20be9bc3b4a259a12298ecab (diff) | |
download | go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.gz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.bz2 go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.lz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.xz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.zst go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.zip |
Upped version number
Diffstat (limited to 'ethchain/stack.go')
-rw-r--r-- | ethchain/stack.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ethchain/stack.go b/ethchain/stack.go index 288360062..e9297b324 100644 --- a/ethchain/stack.go +++ b/ethchain/stack.go @@ -67,6 +67,18 @@ func (st *Stack) Peekn() (*big.Int, *big.Int) { func (st *Stack) Push(d *big.Int) { st.data = append(st.data, d) } + +func (st *Stack) Get(amount *big.Int) []*big.Int { + // offset + size <= len(data) + length := big.NewInt(int64(len(st.data))) + if amount.Cmp(length) <= 0 { + start := new(big.Int).Sub(length, amount) + return st.data[start.Int64():length.Int64()] + } + + return nil +} + func (st *Stack) Print() { fmt.Println("### stack ###") if len(st.data) > 0 { |