@@ -148,29 +148,32 @@ Base.falses(inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {N} =
148148# and one obtains the result below.
149149parentindex (r:: IdOffsetRange , i) = i - r. offset
150150
151- @propagate_inbounds function Base. getindex (A:: OffsetArray{T,N} , I:: Vararg{Int,N} ) where {T,N}
151+ @inline function Base. getindex (A:: OffsetArray{T,N} , I:: Vararg{Int,N} ) where {T,N}
152+ @boundscheck checkbounds (A, I... )
152153 J = map (parentindex, axes (A), I)
153- return parent (A)[J... ]
154+ @inbounds parent (A)[J... ]
154155end
155156
156- @propagate_inbounds Base. getindex (A:: OffsetVector , i:: Int ) = parent (A)[parentindex (Base. axes1 (A), i)]
157+ @inline function Base. getindex (A:: OffsetVector , i:: Int )
158+ @boundscheck checkbounds (A, i)
159+ @inbounds parent (A)[parentindex (Base. axes1 (A), i)]
160+ end
157161@propagate_inbounds Base. getindex (A:: OffsetArray , i:: Int ) = parent (A)[i]
158162
159- @propagate_inbounds function Base. setindex! (A:: OffsetArray{T,N} , val, I:: Vararg{Int,N} ) where {T,N}
163+ @inline function Base. setindex! (A:: OffsetArray{T,N} , val, I:: Vararg{Int,N} ) where {T,N}
160164 @boundscheck checkbounds (A, I... )
161165 J = @inbounds map (parentindex, axes (A), I)
162166 @inbounds parent (A)[J... ] = val
163167 A
164168end
165169
166- @propagate_inbounds function Base. setindex! (A:: OffsetVector , val, i:: Int )
170+ @inline function Base. setindex! (A:: OffsetVector , val, i:: Int )
167171 @boundscheck checkbounds (A, i)
168172 @inbounds parent (A)[parentindex (Base. axes1 (A), i)] = val
169173 A
170174end
171175@propagate_inbounds function Base. setindex! (A:: OffsetArray , val, i:: Int )
172- @boundscheck checkbounds (A, i)
173- @inbounds parent (A)[i] = val
176+ parent (A)[i] = val
174177 A
175178end
176179
0 commit comments