diff options
Diffstat (limited to 'ethvm/stack.go')
-rw-r--r-- | ethvm/stack.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ethvm/stack.go b/ethvm/stack.go index f4b0be393..82dd612c2 100644 --- a/ethvm/stack.go +++ b/ethvm/stack.go @@ -64,6 +64,18 @@ func (st *Stack) Peekn() (*big.Int, *big.Int) { return ints[0], ints[1] } +func (st *Stack) Swapn(n int) (*big.Int, *big.Int) { + st.data[n], st.data[0] = st.data[0], st.data[n] + + return st.data[n], st.data[0] +} + +func (st *Stack) Dupn(n int) *big.Int { + st.Push(st.data[n]) + + return st.Peek() +} + func (st *Stack) Push(d *big.Int) { st.data = append(st.data, new(big.Int).Set(d)) } |