Skip to content

Commit

Permalink
Incorporate symtype in hash for Sym
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenszhu committed Oct 16, 2024
1 parent 62403b9 commit 4be9924
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ const ADD_SALT = 0xaddaddaddaddadda % UInt
const SUB_SALT = 0xaaaaaaaaaaaaaaaa % UInt
const DIV_SALT = 0x334b218e73bbba53 % UInt
const POW_SALT = 0x2b55b97a6efb080c % UInt
function Base.hash(s::BasicSymbolic, salt::UInt)::UInt
function Base.hash(s::BasicSymbolic{T}, salt::UInt)::UInt where {T}
E = exprtype(s)
if E === SYM
hash(nameof(s), salt SYM_SALT)
hash(T, hash(nameof(s), salt SYM_SALT))
elseif E === ADD || E === MUL
!iszero(salt) && return hash(hash(s, zero(UInt)), salt)
h = s.hash[]
Expand Down

0 comments on commit 4be9924

Please sign in to comment.