Skip to content

Commit 0656a12

Browse files
fix: fix optimization in array construction codegen
1 parent d39f830 commit 0656a12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/systems/codegen_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function array_variable_assignments(args...; argument_name = generated_argument_
7979
# to help reduce allocations
8080
if first(idxs) < last(idxs) && vec(idxs) == first(idxs):last(idxs)
8181
idxs = first(idxs):last(idxs)
82-
elseif vec(idxs) == last(idxs):-1:first(idxs)
83-
idxs = last(idxs):-1:first(idxs)
82+
elseif vec(idxs) == first(idxs):-1:last(idxs)
83+
idxs = first(idxs):-1:last(idxs)
8484
else
8585
# Otherwise, turn the indexes into an `SArray` so they're stack-allocated
8686
idxs = SArray{Tuple{size(idxs)...}}(idxs)

0 commit comments

Comments
 (0)