Skip to content

Commit 3212544

Browse files
authored
Fix sizehint for VectorOfArrays(#35)
1 parent 3a6f5ba commit 3212544

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/vector_of_arrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ end
363363

364364

365365
function Base.sizehint!(A::VectorOfArrays{T,N}, n, s::Dims{N}) where {T,N}
366-
sizehint!(A.data, n * mul(s))
366+
sizehint!(A.data, n * prod(s))
367367
sizehint!(A.elem_ptr, n + 1)
368368
sizehint!(A.kernel_size, n)
369369
A

test/vector_of_arrays.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,4 +324,10 @@ using ArraysOfArrays: full_consistency_checks, append_elemptr!, element_ptr
324324
@test @inferred(do_map(identity, A)) === A
325325
end
326326
end
327+
328+
@testset "resize" begin
329+
A1 = VectorOfArrays{Float64, 1}(ref_AoA1(Float64, 3))
330+
sizehint!(A1, 5, (10000,))
331+
@test ccall(:jl_array_size, Int, (Any, UInt), A1.data, 1) == 5*10000
332+
end
327333
end

0 commit comments

Comments
 (0)