Skip to content

Commit

Permalink
fix #245, regression in hash(::Perm)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed May 4, 2020
1 parent 750f7d0 commit ccbc556
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/generic/PermGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ parent(g::Perm{T}) where T = SymmetricGroup(T(length(g.d)))
###############################################################################

# hash(Perm) = 0x0d9939c64ab650ca
Base.hash(g::Perm, h::UInt) = xor(hash(g.d, h), 0x0d9939c64ab650ca)
# note: we don't use hash(g.d, h), as it's unnecessarily slow for this use-case
Base.hash(g::Perm, h::UInt) = foldl((h, x) -> hash(x, h), g.d,
init = hash(0x0d9939c64ab650ca, h))

function getindex(g::Perm, n::Integer)
return g.d[n]
Expand Down

0 comments on commit ccbc556

Please sign in to comment.