compiler: optimize argument reversing
Do not reverse arguments if there is no more than 1.
This commit is contained in:
parent
3729865860
commit
72be5412f4
1 changed files with 1 additions and 0 deletions
|
@ -1011,6 +1011,7 @@ func (c *codegen) dropItems(n int) {
|
||||||
// emitReverse reverses top num items of the stack.
|
// emitReverse reverses top num items of the stack.
|
||||||
func (c *codegen) emitReverse(num int) {
|
func (c *codegen) emitReverse(num int) {
|
||||||
switch num {
|
switch num {
|
||||||
|
case 0, 1:
|
||||||
case 2:
|
case 2:
|
||||||
emit.Opcode(c.prog.BinWriter, opcode.SWAP)
|
emit.Opcode(c.prog.BinWriter, opcode.SWAP)
|
||||||
case 3:
|
case 3:
|
||||||
|
|
Loading…
Reference in a new issue