Skip to content

Commit d266d72

Browse files
get rid of unnecessary generated functions
1 parent 0b6ed6f commit d266d72

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

ext/static/array_index.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ end
1212
return _strides2int(offsets(x), static_strides(x), Tuple(i)) + static(1)
1313
end
1414

15-
@generated function _strides2int(o::O, s::S, i::I) where {O,S,I}
15+
function _strides2int(o::O, s::S, i::I) where {O,S,I}
1616
N = known_length(S)
17-
out = :()
18-
for i in 1:N
19-
tmp = :(((getfield(i, $i) - getfield(o, $i)) * getfield(s, $i)))
20-
out = ifelse(i === 1, tmp, :($out + $tmp))
21-
end
22-
return Expr(:block, Expr(:meta, :inline), out)
17+
sum(ntuple(x->(getfield(i, x) - getfield(o, x)) * getfield(s, x),N))
2318
end

0 commit comments

Comments
 (0)