@@ -148,29 +148,32 @@ Base.falses(inds::NTuple{N, Union{Integer, AbstractUnitRange}}) where {N} =
148
148
# and one obtains the result below.
149
149
parentindex (r:: IdOffsetRange , i) = i - r. offset
150
150
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... )
152
153
J = map (parentindex, axes (A), I)
153
- return parent (A)[J... ]
154
+ @inbounds parent (A)[J... ]
154
155
end
155
156
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
157
161
@propagate_inbounds Base. getindex (A:: OffsetArray , i:: Int ) = parent (A)[i]
158
162
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}
160
164
@boundscheck checkbounds (A, I... )
161
165
J = @inbounds map (parentindex, axes (A), I)
162
166
@inbounds parent (A)[J... ] = val
163
167
A
164
168
end
165
169
166
- @propagate_inbounds function Base. setindex! (A:: OffsetVector , val, i:: Int )
170
+ @inline function Base. setindex! (A:: OffsetVector , val, i:: Int )
167
171
@boundscheck checkbounds (A, i)
168
172
@inbounds parent (A)[parentindex (Base. axes1 (A), i)] = val
169
173
A
170
174
end
171
175
@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
174
177
A
175
178
end
176
179
0 commit comments