Skip to content

Commit e38b999

Browse files
try easy fixes
1 parent 2de2f32 commit e38b999

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

ext/static/array_index.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,5 @@ end
1111
@inline function Base.getindex(x::StrideIndex{N}, i::AbstractCartesianIndex) where {N}
1212
return _strides2int(offsets(x), static_strides(x), Tuple(i)) + static(1)
1313
end
14-
@generated function _strides2int(o::O, s::S, i::I) where {O,S,I}
15-
N = known_length(S)
16-
out = :()
17-
for i in 1:N
18-
tmp = :(((getfield(i, $i) - getfield(o, $i)) * getfield(s, $i)))
19-
out = ifelse(i === 1, tmp, :($out + $tmp))
20-
end
21-
return Expr(:block, Expr(:meta, :inline), out)
22-
end
14+
2315

src/ArrayInterface.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,16 @@ function to_axis end
11441144
function is_dense end
11451145
function static_getindex end
11461146

1147+
@generated function _strides2int(o::O, s::S, i::I) where {O,S,I}
1148+
N = known_length(S)
1149+
out = :()
1150+
for i in 1:N
1151+
tmp = :(((getfield(i, $i) - getfield(o, $i)) * getfield(s, $i)))
1152+
out = ifelse(i === 1, tmp, :($out + $tmp))
1153+
end
1154+
return Expr(:block, Expr(:meta, :inline), out)
1155+
end
1156+
11471157
## Shadowing
11481158
## This is really dumb, it breaks every style guide idea, who did this, this is so bad, remove ASAP
11491159

0 commit comments

Comments
 (0)