Skip to content

Commit

Permalink
De-lv quicksort
Browse files Browse the repository at this point in the history
  • Loading branch information
brenhinkeller committed Jun 13, 2024
1 parent 8ac5d8d commit 359b367
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Sorting/quicksort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function sortnans!(A, iₗ=firstindex(A), iᵤ=lastindex(A))

# Count up NaNs
Nₙₐₙ = 0
@turbo for i = iₗ:iᵤ
@inbounds @simd ivdep for i = iₗ:iᵤ
Nₙₐₙ += A[i] != A[i]
end
# If none, return early
Expand Down Expand Up @@ -61,7 +61,7 @@ end
A[𝔦ₗ], A[𝔦ᵤ] = A[𝔦ᵤ], A[𝔦ₗ]
end
else
@turbo for i 0:n
@inbounds @simd ivdep for i 0:n
𝔦ₗ = iₗ+i
𝔦ᵤ = iᵤ-i
l = A[𝔦ₗ]
Expand Down Expand Up @@ -115,7 +115,7 @@ function quicksort!(A, iₗ=firstindex(A), iᵤ=lastindex(A))

# Count up elements that must be moved to upper partition
Nᵤ = 0
@turbo for i = (iₗ+1):iᵤ
@inbounds @simd ivdep for i = (iₗ+1):iᵤ
Nᵤ += A[i] >= pivot
end
Nₗ = N - Nᵤ
Expand Down

0 comments on commit 359b367

Please sign in to comment.