Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eliminate the dead iterate branch in _unsafe_(get)setindex!. #52809

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prefer index over iteration.
  • Loading branch information
N5N3 committed Feb 12, 2024
commit b33eb99afb3d54c56f6bbef7859fa19721d976ef
9 changes: 5 additions & 4 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -972,11 +972,12 @@ function _generate_unsafe_setindex!_body(N::Int)
@nexprs $N d->(I_d = unalias(A, I[d]))
idxlens = @ncall $N index_lengths I
@ncall $N setindex_shape_check x′ (d->idxlens[d])
Xy = _checked_iterate(x′)
X = eachindex(x′)
Xy = _checked_iterate(X)
@inbounds @nloops $N i d->I_d begin
(val, state) = Xy::NTuple{2,Any}
@ncall $N setindex! A val i
Xy = _checked_iterate(x′, state)
(idx, state) = Xy::NTuple{2,Any}
@ncall $N setindex! A x′[idx] i
Xy = _checked_iterate(X, state)
end
A
end
Expand Down