You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note line 267 in the above code. hashoffset of type UInt, serving as a seed, is the first argument of the hash function. Although it still works, it somehow violates the original design principle of 2-argument hash functions.
hash(::UInt, ::UInt) just combines the arguments in a noncommutative way, with a multiplication and subtraction as you say. So it's quite cheap, but you could save a cycle or two by using ⊻ for mixing hashoffset with the computed hash instead of calling hash(::UInt, ::UInt).
SymbolicUtils.jl/src/types.jl
Lines 254 to 269 in e9a96bd
Note line 267 in the above code.
hashoffset
of typeUInt
, serving as a seed, is the first argument of the hash function. Although it still works, it somehow violates the original design principle of 2-argument hash functions.For
hash(x::Int64, h::UInt)
, Julia Base focuses on the first argument and merely does a scalar multiplication and subtraction to the second argument, which is probably not what we want.https://github.com/JuliaLang/julia/blob/57b9b591e28181aee8ff985d0ace661b408577d7/base/hashing.jl#L88
https://github.com/JuliaLang/julia/blob/57b9b591e28181aee8ff985d0ace661b408577d7/base/hashing.jl#L79
https://github.com/JuliaLang/julia/blob/57b9b591e28181aee8ff985d0ace661b408577d7/base/hashing.jl#L44
The text was updated successfully, but these errors were encountered: