diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-10 23:45:21 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-10 23:47:36 +0800 |
commit | fc2a061d510fbe09534ee1ade167d66c40ba7bf1 (patch) | |
tree | 39f3234c4a88ad3457c997ad2ca58a7296426a39 /core/vm/stack.go | |
parent | 065aff9ffa2bee1008d1f406328dd12a073cb239 (diff) | |
download | dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar.gz dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar.bz2 dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar.lz dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar.xz dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.tar.zst dexon-fc2a061d510fbe09534ee1ade167d66c40ba7bf1.zip |
core/vm: unexported stack again. No longer required
Diffstat (limited to 'core/vm/stack.go')
-rw-r--r-- | core/vm/stack.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/core/vm/stack.go b/core/vm/stack.go index 1d0a018c6..b551de272 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -5,20 +5,20 @@ import ( "math/big" ) -func newStack() *Stack { - return &Stack{} +func newstack() *stack { + return &stack{} } -type Stack struct { +type stack struct { data []*big.Int ptr int } -func (st *Stack) Data() []*big.Int { +func (st *stack) Data() []*big.Int { return st.data } -func (st *Stack) push(d *big.Int) { +func (st *stack) push(d *big.Int) { // NOTE push limit (1024) is checked in baseCheck stackItem := new(big.Int).Set(d) if len(st.data) > st.ptr { @@ -29,36 +29,36 @@ func (st *Stack) push(d *big.Int) { st.ptr++ } -func (st *Stack) pop() (ret *big.Int) { +func (st *stack) pop() (ret *big.Int) { st.ptr-- ret = st.data[st.ptr] return } -func (st *Stack) len() int { +func (st *stack) len() int { return st.ptr } -func (st *Stack) swap(n int) { +func (st *stack) swap(n int) { st.data[st.len()-n], st.data[st.len()-1] = st.data[st.len()-1], st.data[st.len()-n] } -func (st *Stack) dup(n int) { +func (st *stack) dup(n int) { st.push(st.data[st.len()-n]) } -func (st *Stack) peek() *big.Int { +func (st *stack) peek() *big.Int { return st.data[st.len()-1] } -func (st *Stack) require(n int) error { +func (st *stack) require(n int) error { if st.len() < n { return fmt.Errorf("stack underflow (%d <=> %d)", len(st.data), n) } return nil } -func (st *Stack) Print() { +func (st *stack) Print() { fmt.Println("### stack ###") if len(st.data) > 0 { for i, val := range st.data { |