Skip to content

Commit 463ea70

Browse files
use stevengj's suggested hash(Char) definition
1 parent 7a53cb3 commit 463ea70

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

base/char.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ in(x::Char, y::Char) = x == y
8181

8282
==(x::Char, y::Char) = reinterpret(UInt32, x) == reinterpret(UInt32, y)
8383
isless(x::Char, y::Char) = reinterpret(UInt32, x) < reinterpret(UInt32, y)
84-
hash(x::Char, h::UInt) = hash(reinterpret(UInt32, x), hash(Char, h))
84+
hash(x::Char, h::UInt) =
85+
hash_uint64(((reinterpret(UInt32, x) + UInt64(0xd4d64234)) << 32) UInt64(h))
8586

8687
-(x::Char, y::Char) = Int(x) - Int(y)
8788
-(x::Char, y::Integer) = Char(Int32(x) - Int32(y))

0 commit comments

Comments
 (0)