75
75
@inline index_size (:: Size , :: Int ) = Size ()
76
76
@inline index_size (:: Size , a:: StaticArray ) = Size (a)
77
77
@inline index_size (s:: Size , :: Colon ) = s
78
- @inline index_size (s :: Size , a:: SOneTo{n } ) where n = Size (n ,)
78
+ @inline index_size (:: Size , a:: AbstractRange{<:Integer } ) = Size (length (a) ,)
79
79
80
80
@inline index_sizes (:: S , inds... ) where {S<: Size } = map (index_size, unpack_size (S), inds)
81
81
@@ -92,9 +92,9 @@ linear_index_size(ind_sizes::Type{<:Size}...) = _linear_index_size((), ind_sizes
92
92
@inline _linear_index_size (t:: Tuple , :: Type{Size{S}} , ind_sizes... ) where {S} = _linear_index_size ((t... , prod (S)), ind_sizes... )
93
93
94
94
_ind (i:: Int , :: Int , :: Type{Int} ) = :(inds[$ i])
95
- _ind (i:: Int , j:: Int , :: Type{<:StaticArray} ) = :(inds[$ i][$ j])
96
95
_ind (i:: Int , j:: Int , :: Type{Colon} ) = j
97
96
_ind (i:: Int , j:: Int , :: Type{<:SOneTo} ) = j
97
+ _ind (i:: Int , j:: Int , :: Type{<:AbstractArray} ) = :(inds[$ i][$ j])
98
98
99
99
# ###############################
100
100
# # Non-scalar linear indexing ##
215
215
216
216
# getindex
217
217
218
- @propagate_inbounds function getindex (a:: StaticArray , inds:: Union{Int, StaticArray{<:Tuple, Int}, SOneTo , Colon} ...)
218
+ @propagate_inbounds function getindex (a:: StaticArray , inds:: Union{Int, StaticArray{<:Tuple, Int}, AbstractRange , Colon} ...)
219
219
_getindex (a, index_sizes (Size (a), inds... ), inds)
220
220
end
221
221
0 commit comments