@@ -33,8 +33,8 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S, N}} <: AbstractArray{T, N}
3333 isbitstype (T) || throwbits (S, T, T)
3434 isbitstype (S) || throwbits (S, T, S)
3535 (N != 0 || sizeof (T) == sizeof (S)) || throwsize0 (S, T)
36- ax1 = axes (a)[1 ]
3736 if N != 0 && sizeof (S) != sizeof (T)
37+ ax1 = axes (a)[1 ]
3838 dim = length (ax1)
3939 rem (dim* sizeof (S),sizeof (T)) == 0 || thrownonint (S, T, dim)
4040 first (ax1) == 1 || throwaxes1 (S, T, ax1)
@@ -74,13 +74,15 @@ function size(a::ReinterpretArray{T,N,S} where {N}) where {T,S}
7474 size1 = div (psize[1 ]* sizeof (S), sizeof (T))
7575 tuple (size1, tail (psize)... )
7676end
77+ size (a:: ReinterpretArray{T,0} ) where {T} = ()
7778
7879function axes (a:: ReinterpretArray{T,N,S} where {N}) where {T,S}
7980 paxs = axes (a. parent)
8081 f, l = first (paxs[1 ]), length (paxs[1 ])
8182 size1 = div (l* sizeof (S), sizeof (T))
8283 tuple (oftype (paxs[1 ], f: f+ size1- 1 ), tail (paxs)... )
8384end
85+ axes (a:: ReinterpretArray{T,0} ) where {T} = ()
8486
8587elsize (:: Type{<:ReinterpretArray{T}} ) where {T} = sizeof (T)
8688unsafe_convert (:: Type{Ptr{T}} , a:: ReinterpretArray{T,N,S} where N) where {T,S} = Ptr {T} (unsafe_convert (Ptr{S},a. parent))
0 commit comments