Skip to content

Commit 1be995c

Browse files
authored
Merge fix
1 parent ad86fc4 commit 1be995c

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

base/abstractarray.jl

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
22802280
nrc = nr * nc
22812281
na = prod(size(A)[3:end])
22822282
k = 1
2283-
for d 1:na
2283+
@inbounds for d 1:na
22842284
dd = nrc * (d - 1)
22852285
for i 1:nr
22862286
Ai = dd + i
@@ -2292,7 +2292,7 @@ function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
22922292
end
22932293
end
22942294
else
2295-
for k eachindex(xs)
2295+
@inbounds for k eachindex(xs)
22962296
A[k] = xs[k]
22972297
end
22982298
end
@@ -2458,34 +2458,6 @@ function _typed_hvncat_shape(::Type{T}, shape::NTuple{N, Tuple}, row_first, as::
24582458
return A
24592459
end
24602460

2461-
function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
2462-
# putting these in separate functions leads to unnecessary allocations
2463-
lenxs = length(xs)
2464-
lena = length(A)
2465-
lenxs == lena || throw(ArgumentError("number of elements doesn't match specified shape"))
2466-
if row_first
2467-
nr, nc = size(A, 1), size(A, 2)
2468-
nrc = nr * nc
2469-
na = prod(size(A)[3:end])
2470-
k = 1
2471-
@inbounds for d 1:na
2472-
dd = nrc * (d - 1)
2473-
for i 1:nr
2474-
Ai = dd + i
2475-
for _ 1:nc
2476-
A[Ai] = xs[k]
2477-
k += 1
2478-
Ai += nr
2479-
end
2480-
end
2481-
end
2482-
else
2483-
@inbounds for k eachindex(xs)
2484-
A[k] = xs[k]
2485-
end
2486-
end
2487-
end
2488-
24892461
function hvncat_fill!(A::AbstractArray{T, N}, scratch1::Vector{Int}, scratch2::Vector{Int},
24902462
d1::Int, d2::Int, as::Tuple) where {T, N}
24912463
length(scratch1) == length(scratch2) == N ||

0 commit comments

Comments
 (0)