Skip to content

Commit

Permalink
Merge pull request JuliaLang#6538 from tanmaykm/tanmaykm
Browse files Browse the repository at this point in the history
reverse range with select gives empty result. fixes JuliaLang#6534
  • Loading branch information
JeffBezanson committed Apr 16, 2014
2 parents c921451 + 107178a commit 409745c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ function select!(v::AbstractVector, k::Int, lo::Int, hi::Int, o::Ordering)
end

function select!(v::AbstractVector, r::UnitRange, lo::Int, hi::Int, o::Ordering)
isempty(r) && (return v[r])
a, b = first(r), last(r)
lo <= a <= b <= hi || error("select index $k is out of range $lo:$hi")
lo <= a <= b <= hi || error("selection $r is out of range $lo:$hi")
@inbounds while true
if lo == a && hi == b
sort!(v, lo, hi, DEFAULT_UNSTABLE, o)
Expand Down

0 comments on commit 409745c

Please sign in to comment.