Skip to content

Commit d973c64

Browse files
committed
Ensure SIMD happens
1 parent 66a9e6a commit d973c64

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/ArrayInterface.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,12 @@ Return a new instance of `collection` with `item` inserted into at the given `in
551551
Base.@propagate_inbounds function insert(collection, index, item)
552552
@boundscheck checkbounds(collection, index)
553553
ret = similar(collection, length(collection) + 1)
554-
@inbounds for i in indices(ret)
555-
if i < index
554+
@inbounds for i in firstindex(ret):(index - 1)
556555
ret[i] = collection[i]
557-
elseif i == index
558-
ret[i] = item
559-
else
556+
end
557+
@inbounds ret[index] = item
558+
@inbounds for i in (index + 1):lastindex(ret)
560559
ret[i] = collection[i - 1]
561-
end
562560
end
563561
return ret
564562
end

0 commit comments

Comments
 (0)