Skip to content

Commit

Permalink
Ensure SIMD happens
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokazama committed Sep 14, 2020
1 parent 66a9e6a commit d973c64
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/ArrayInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,12 @@ Return a new instance of `collection` with `item` inserted into at the given `in
Base.@propagate_inbounds function insert(collection, index, item)
@boundscheck checkbounds(collection, index)
ret = similar(collection, length(collection) + 1)
@inbounds for i in indices(ret)
if i < index
@inbounds for i in firstindex(ret):(index - 1)
ret[i] = collection[i]
elseif i == index
ret[i] = item
else
end
@inbounds ret[index] = item
@inbounds for i in (index + 1):lastindex(ret)
ret[i] = collection[i - 1]
end
end
return ret
end
Expand Down

0 comments on commit d973c64

Please sign in to comment.