Skip to content

Commit 47096bf

Browse files
committed
have axes(reinterpret(reshape,T,::AbstractArray{S}),1) where sizeof(S) > sizeof(T) return a static range
1 parent bb56a11 commit 47096bf

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "3.1.29"
3+
version = "3.1.30"
44

55
[deps]
66
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

src/axes.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ end
148148

149149

150150
@inline _axes(A::SubArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
151-
@inline _axes(A::ReinterpretArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
151+
@inline function _axes(A::ReinterpretArray{T,N,S}, dim::Integer) where {T,N,S}
152+
if _is_reshaped(typeof(A)) && (sizeof(S) > sizeof(T)) && dim == 1
153+
return One():static(div(sizeof(S), sizeof(T)))
154+
end
155+
Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
156+
end
152157
@inline _axes(A::Base.ReshapedArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
153158

154159
"""

0 commit comments

Comments
 (0)