good morning!!!!

Skip to content
Snippets Groups Projects
Commit 504d3562 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Added peek(n)

parent 059ad352
No related branches found
No related tags found
No related merge requests found
...@@ -159,6 +159,22 @@ func (st *Stack) Popn() (*big.Int, *big.Int) { ...@@ -159,6 +159,22 @@ func (st *Stack) Popn() (*big.Int, *big.Int) {
return ints[0], ints[1] 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) { func (st *Stack) Push(d *big.Int) {
st.data = append(st.data, d) st.data = append(st.data, d)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment