Skip to content

Commit dad2a2c

Browse files
committed
Clarify comments in twoended_merge!
2 parents 436eb79 + ce9ad62 commit dad2a2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/SortingAlgorithms.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ function twoended_merge!(v::AbstractVector{T}, t::AbstractVector{T}, lo::Integer
703703

704704
@inbounds begin
705705
# two ended merge
706+
# while at least 2 elements remain in both A and B
706707
while iAL < iAR && iBL < iBR
707708
if lt(o,v[iBL], v[iAL])
708709
t[oL] = v[iBL]
@@ -712,7 +713,6 @@ function twoended_merge!(v::AbstractVector{T}, t::AbstractVector{T}, lo::Integer
712713
iAL += 1
713714
end
714715
oL +=1
715-
716716
if lt(o,v[iAR], v[iBR])
717717
t[oR] = v[iBR]
718718
iBR -= 1
@@ -722,8 +722,8 @@ function twoended_merge!(v::AbstractVector{T}, t::AbstractVector{T}, lo::Integer
722722
end
723723
oR -=1
724724
end
725-
# cleanup
726725
# regular merge
726+
# until either A or B runs out
727727
while iAL <= iAR && iBL <= iBR
728728
if lt(o,v[iBL], v[iAL])
729729
t[oL] = v[iBL]

0 commit comments

Comments
 (0)