Skip to content

Commit 5dd70ee

Browse files
Merge pull request #166 from donutloop/master
incrementChildPrio: Improved swap node position
2 parents 4563b0b + d35c3c3 commit 5dd70ee

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tree.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ func (n *node) incrementChildPrio(pos int) int {
6060
newPos := pos
6161
for newPos > 0 && n.children[newPos-1].priority < prio {
6262
// swap node positions
63-
tmpN := n.children[newPos-1]
64-
n.children[newPos-1] = n.children[newPos]
65-
n.children[newPos] = tmpN
63+
n.children[newPos-1], n.children[newPos] = n.children[newPos], n.children[newPos-1]
6664

6765
newPos--
6866
}

0 commit comments

Comments
 (0)