aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-21 06:10:16 +0800
committerobscuren <geffobscura@gmail.com>2014-02-21 06:10:16 +0800
commit504d356232e11e98a19f9f2b6fd5ee61a5226b1d (patch)
tree9cdf5ea7d040063fd906ed2d1b59a62c32328061
parent059ad352156b995aab9132aff9569c2e03c32b9b (diff)
downloaddexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar.gz
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar.bz2
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar.lz
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar.xz
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.tar.zst
dexon-504d356232e11e98a19f9f2b6fd5ee61a5226b1d.zip
Added peek(n)
-rw-r--r--ethchain/stack.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/ethchain/stack.go b/ethchain/stack.go
index 74f3d7ec9..e08f84082 100644
--- a/ethchain/stack.go
+++ b/ethchain/stack.go
@@ -159,6 +159,22 @@ func (st *Stack) Popn() (*big.Int, *big.Int) {
return ints[0], ints[1]
}
+func (st *Stack) Peek() *big.Int {
+ s := len(st.data)
+
+ str := st.data[s-1]
+
+ return str
+}
+
+func (st *Stack) Peekn() (*big.Int, *big.Int) {
+ s := len(st.data)
+
+ ints := st.data[s-2:]
+
+ return ints[0], ints[1]
+}
+
func (st *Stack) Push(d *big.Int) {
st.data = append(st.data, d)
}