File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -115,4 +115,4 @@ function Base.view(
115115 return SizedArray {new_size} (view_from_invoke)
116116end
117117
118- Base. elsize (:: Type{<:MArray{S, T}} ) where {S,T} = sizeof (T )
118+ Base. elsize (:: Type{<:MArray{<:Any, T}} ) where T = Base . elsize (Vector{T} )
Original file line number Diff line number Diff line change 220220 v[] = 2
221221 @test v[] == 2
222222 end
223+
224+ @testset " non-power-of-2 element size" begin
225+ primitive type Test24 24 end
226+ Test24 (n) = Base. trunc_int (Test24, n)
227+ a = Test24 .(1 : 4 )
228+ m = MVector {4} (a)
229+ @test m == m[:] == m[1 : 4 ] == a
230+ @test getindex .(Ref (m), 1 : 4 ) == a
231+ @test GC. @preserve m unsafe_load .(pointer (m), 1 : 4 ) == a
232+ @test GC. @preserve m unsafe_load .(pointer .(Ref (m), 1 : 4 )) == a
233+ b = Test24 .(5 : 8 )
234+ setindex! .(Ref (m), b, 1 : 4 )
235+ @test m == b
236+ end
223237end
224238
225239@testset " some special case" begin
You can’t perform that action at this time.
0 commit comments