aboutsummaryrefslogtreecommitdiffstats
path: root/ethvm/stack.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-22 00:15:09 +0800
committerobscuren <geffobscura@gmail.com>2014-08-22 00:15:09 +0800
commita289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8 (patch)
tree987e3213ab37f1c07d0d917a92fe6654ba271a5d /ethvm/stack.go
parent3def9258be3c212bf405502f84654f45b0306543 (diff)
downloaddexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar.gz
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar.bz2
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar.lz
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar.xz
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.tar.zst
dexon-a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8.zip
DUP n SWAP n
Diffstat (limited to 'ethvm/stack.go')
-rw-r--r--ethvm/stack.go12
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))
}