Skip to content

Commit

Permalink
Force indices to inline
Browse files Browse the repository at this point in the history
Kind of surprising this doesn't happen automatically
  • Loading branch information
timholy committed May 11, 2016
1 parent 528249d commit 7f3981f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ size(x, d1::Integer, d2::Integer, dx::Integer...) = tuple(size(x, d1), size(x, d
Returns the valid range of indices for array `A` along dimension `d`.
"""
indices(A::AbstractArray, d) = 1:size(A,d)
function indices(A::AbstractArray, d)
@_inline_meta
1:size(A,d)
end
"""
indices(A)
Returns the tuple of valid indices for array `A`.
"""
indices{T,N}(A::AbstractArray{T,N}) = ntuple(d->indices(A, d), Val{N})
function indices{T,N}(A::AbstractArray{T,N})
@_inline_meta
ntuple(d->indices(A, d), Val{N})
end
eltype{T}(::Type{AbstractArray{T}}) = T
eltype{T,n}(::Type{AbstractArray{T,n}}) = T
elsize{T}(::AbstractArray{T}) = sizeof(T)
Expand Down

0 comments on commit 7f3981f

Please sign in to comment.