Skip to content

Commit 9e14448

Browse files
committed
Force indices to inline
Kind of surprising this doesn't happen automatically
1 parent 098cb5f commit 9e14448

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

base/abstractarray.jl

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ size(x, d1::Integer, d2::Integer, dx::Integer...) = tuple(size(x, d1), size(x, d
2626
2727
Returns the valid range of indices for array `A` along dimension `d`.
2828
"""
29-
indices(A::AbstractArray, d) = 1:size(A,d)
29+
function indices(A::AbstractArray, d)
30+
@_inline_meta
31+
1:size(A,d)
32+
end
3033
"""
3134
indices(A)
3235
3336
Returns the tuple of valid indices for array `A`.
3437
"""
35-
indices{T,N}(A::AbstractArray{T,N}) = ntuple(d->indices(A, d), Val{N})
38+
function indices{T,N}(A::AbstractArray{T,N})
39+
@_inline_meta
40+
ntuple(d->indices(A, d), Val{N})
41+
end
3642
eltype{T}(::Type{AbstractArray{T}}) = T
3743
eltype{T,n}(::Type{AbstractArray{T,n}}) = T
3844
elsize{T}(::AbstractArray{T}) = sizeof(T)

0 commit comments

Comments
 (0)