Skip to content

Commit

Permalink
Merge pull request #198 from JuliaArrays/staticfirstreinterpretaxes
Browse files Browse the repository at this point in the history
have axes(reinterpret(reshape,T,::AbstractArray{S}),1)  be static sometimes
  • Loading branch information
chriselrod committed Aug 31, 2021
2 parents bb56a11 + 47096bf commit f8d1182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ArrayInterface"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "3.1.29"
version = "3.1.30"

[deps]
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
Expand Down
7 changes: 6 additions & 1 deletion src/axes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,12 @@ end


@inline _axes(A::SubArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
@inline _axes(A::ReinterpretArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
@inline function _axes(A::ReinterpretArray{T,N,S}, dim::Integer) where {T,N,S}
if _is_reshaped(typeof(A)) && (sizeof(S) > sizeof(T)) && dim == 1
return One():static(div(sizeof(S), sizeof(T)))
end
Base.axes(A, Int(dim)) # TODO implement ArrayInterface version
end
@inline _axes(A::Base.ReshapedArray, dim::Integer) = Base.axes(A, Int(dim)) # TODO implement ArrayInterface version

"""
Expand Down

2 comments on commit f8d1182

@chriselrod
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/43859

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.1.30 -m "<description of version>" f8d1182f4f6473ddad1fa37aa2c043d9692ca01b
git push origin v3.1.30

Please sign in to comment.