Use non-overlapping swap for inner heapsort loop · qinheping/verify-rust-std@5446229 (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -69,9 +69,7 @@ where
69 69 break;
70 70 }
71 71
72 -// Swap `node` with the greater child, move one step down, and continue sifting. This
73 -// could be ptr::swap_nonoverlapping but that adds a significant amount of binary-size.
74 - ptr::swap(v_base.add(node), v_base.add(child));
72 + ptr::swap_nonoverlapping(v_base.add(node), v_base.add(child), 1);
75 73 }
76 74
77 75 node = child;