From 504d356232e11e98a19f9f2b6fd5ee61a5226b1d Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 20 Feb 2014 23:10:16 +0100 Subject: Added peek(n) --- ethchain/stack.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ethchain') 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) } -- cgit