Skip to content

Commit 07e88a6

Browse files
committed
Be more careful about at-inbounds.
1 parent eeb23d2 commit 07e88a6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/host/indexing.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ end
140140
Is::Vararg{<:Any,N}) where {N}
141141
quote
142142
i = @linearidx dest
143-
@inbounds begin
144-
is = CartesianIndices(idims)[i]
145-
@nexprs $N i -> I_i = Is[i][is[i]]
146-
dest[i] = @ncall $N getindex src i -> I_i
147-
end
143+
is = @inbounds CartesianIndices(idims)[i]
144+
@nexprs $N i -> I_i = @inbounds(Is[i][is[i]])
145+
val = @ncall $N getindex src i -> I_i
146+
@inbounds dest[i] = val
148147
return
149148
end
150149
end
@@ -169,11 +168,9 @@ end
169168
quote
170169
i = linear_index(ctx)
171170
i > len && return
172-
@inbounds begin
173-
is = CartesianIndices(idims)[i]
174-
@nexprs $N i -> I_i = Is[i][is[i]]
175-
@ncall $N setindex! dest src[i] i -> I_i
176-
end
171+
is = @inbounds CartesianIndices(idims)[i]
172+
@nexprs $N i -> I_i = @inbounds(Is[i][is[i]])
173+
@ncall $N setindex! dest src[i] i -> I_i
177174
return
178175
end
179176
end

0 commit comments

Comments
 (0)