From 351a6813824d7f7d3821a11929e9b6e45b54b705 Mon Sep 17 00:00:00 2001 From: lmittmann Date: Thu, 1 Aug 2024 11:16:45 +0200 Subject: [PATCH] dropped `swap(n)` --- core/vm/stack.go | 4 ---- core/vm/stack_test.go | 25 ------------------------- 2 files changed, 29 deletions(-) delete mode 100644 core/vm/stack_test.go diff --git a/core/vm/stack.go b/core/vm/stack.go index 5b92db6098..879dc9aa6d 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -64,10 +64,6 @@ func (st *Stack) len() int { return len(st.data) } -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) swap1() { st.data[st.len()-2], st.data[st.len()-1] = st.data[st.len()-1], st.data[st.len()-2] } diff --git a/core/vm/stack_test.go b/core/vm/stack_test.go deleted file mode 100644 index a5d2856057..0000000000 --- a/core/vm/stack_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package vm - -import ( - "testing" - - "github.com/holiman/uint256" -) - -func BenchmarkStackSwap(b *testing.B) { - stack := newstack() - stack.push(new(uint256.Int)) - stack.push(new(uint256.Int)) - - b.Run("swap(1)", func(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.swap(1) - } - }) - - b.Run("swap1()", func(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.swap1() - } - }) -}