Skip to content

Commit eed39fa

Browse files
committed
Merge fix
1 parent 796d999 commit eed39fa

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
@@ -2341,7 +2341,7 @@ function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
23412341
nrc = nr * nc
23422342
na = prod(size(A)[3:end])
23432343
k = 1
2344-
for d 1:na
2344+
@inbounds for d 1:na
23452345
dd = nrc * (d - 1)
23462346
for i 1:nr
23472347
Ai = dd + i
@@ -2353,7 +2353,7 @@ function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
23532353
end
23542354
end
23552355
else
2356-
for k eachindex(xs)
2356+
@inbounds for k eachindex(xs)
23572357
A[k] = xs[k]
23582358
end
23592359
end
@@ -2537,34 +2537,6 @@ function _typed_hvncat_shape(::Type{T}, shape::NTuple{N, Tuple}, row_first, as::
25372537
return A
25382538
end
25392539

2540-
function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
2541-
# putting these in separate functions leads to unnecessary allocations
2542-
lenxs = length(xs)
2543-
lena = length(A)
2544-
lenxs == lena || throw(ArgumentError("number of elements doesn't match specified shape"))
2545-
if row_first
2546-
nr, nc = size(A, 1), size(A, 2)
2547-
nrc = nr * nc
2548-
na = prod(size(A)[3:end])
2549-
k = 1
2550-
@inbounds for d 1:na
2551-
dd = nrc * (d - 1)
2552-
for i 1:nr
2553-
Ai = dd + i
2554-
for _ 1:nc
2555-
A[Ai] = xs[k]
2556-
k += 1
2557-
Ai += nr
2558-
end
2559-
end
2560-
end
2561-
else
2562-
@inbounds for k eachindex(xs)
2563-
A[k] = xs[k]
2564-
end
2565-
end
2566-
end
2567-
25682540
function hvncat_fill!(A::AbstractArray{T, N}, scratch1::Vector{Int}, scratch2::Vector{Int},
25692541
d1::Int, d2::Int, as::Tuple) where {T, N}
25702542
length(scratch1) == length(scratch2) == N ||

0 commit comments

Comments
 (0)