@@ -33,8 +33,8 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S, N}} <: AbstractArray{T, N}
33
33
isbitstype (T) || throwbits (S, T, T)
34
34
isbitstype (S) || throwbits (S, T, S)
35
35
(N != 0 || sizeof (T) == sizeof (S)) || throwsize0 (S, T)
36
- ax1 = axes (a)[1 ]
37
36
if N != 0 && sizeof (S) != sizeof (T)
37
+ ax1 = axes (a)[1 ]
38
38
dim = length (ax1)
39
39
rem (dim* sizeof (S),sizeof (T)) == 0 || thrownonint (S, T, dim)
40
40
first (ax1) == 1 || throwaxes1 (S, T, ax1)
@@ -74,13 +74,15 @@ function size(a::ReinterpretArray{T,N,S} where {N}) where {T,S}
74
74
size1 = div (psize[1 ]* sizeof (S), sizeof (T))
75
75
tuple (size1, tail (psize)... )
76
76
end
77
+ size (a:: ReinterpretArray{T,0} ) where {T} = ()
77
78
78
79
function axes (a:: ReinterpretArray{T,N,S} where {N}) where {T,S}
79
80
paxs = axes (a. parent)
80
81
f, l = first (paxs[1 ]), length (paxs[1 ])
81
82
size1 = div (l* sizeof (S), sizeof (T))
82
83
tuple (oftype (paxs[1 ], f: f+ size1- 1 ), tail (paxs)... )
83
84
end
85
+ axes (a:: ReinterpretArray{T,0} ) where {T} = ()
84
86
85
87
elsize (:: Type{<:ReinterpretArray{T}} ) where {T} = sizeof (T)
86
88
unsafe_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