浏览代码

improved swap (#974)

田欧 8 年之前
父节点
当前提交
7d043cedb1
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      tree.go

+ 1 - 3
tree.go

@@ -105,9 +105,7 @@ func (n *node) incrementChildPrio(pos int) int {
 	newPos := pos
 	for newPos > 0 && n.children[newPos-1].priority < prio {
 		// swap node positions
-		tmpN := n.children[newPos-1]
-		n.children[newPos-1] = n.children[newPos]
-		n.children[newPos] = tmpN
+		n.children[newPos-1], n.children[newPos] = n.children[newPos], n.children[newPos-1]
 
 		newPos--
 	}