Skip to content

Commit

Permalink
simplify, and 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Apr 23, 2021
1 parent 6b71a3c commit 08fbde1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/UniqueVectors.jl
Expand Up @@ -167,14 +167,9 @@ function swap!(uv::UniqueVector, to::Int, from::Int)
end

function permute!(uv::UniqueVector, perm::AbstractVector)
# This allocates, but usually permute!(a, p) = permute!!(a, copymutable(p)) would anyway
ip = invperm(perm)
map!(i -> get(ip, i, 0), uv.lookup.vals, uv.lookup.vals)
if ismutable(ip)
Base.invpermute!!(uv.items, ip) # save the allocation, so long as ip isn't an SVector or something
else
permute!(uv.items, perm)
end
permute!(uv.items, perm)
return uv
end

Expand Down

0 comments on commit 08fbde1

Please sign in to comment.