Skip to content

Commit

Permalink
make simd loop over ranges perform better
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jul 18, 2018
1 parent 565bd4d commit 06e7ad4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ length(r::OneTo) = unsafe_length(r)
length(r::StepRangeLen) = r.len
length(r::LinRange) = r.len

# Needed to fold the `firstindex` call in SimdLoop.simd_index
firstindex(::UnitRange) = 1
firstindex(::StepRange) = 1
firstindex(::LinRange) = 1

function length(r::StepRange{T}) where T<:Union{Int,UInt,Int64,UInt64}
isempty(r) && return zero(T)
if r.step > 1
Expand Down

0 comments on commit 06e7ad4

Please sign in to comment.