Skip to content

Commit

Permalink
use stevengj's suggested hash(Char) definition
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Dec 9, 2017
1 parent 7a53cb3 commit 463ea70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ in(x::Char, y::Char) = x == y

==(x::Char, y::Char) = reinterpret(UInt32, x) == reinterpret(UInt32, y)
isless(x::Char, y::Char) = reinterpret(UInt32, x) < reinterpret(UInt32, y)
hash(x::Char, h::UInt) = hash(reinterpret(UInt32, x), hash(Char, h))
hash(x::Char, h::UInt) =
hash_uint64(((reinterpret(UInt32, x) + UInt64(0xd4d64234)) << 32) UInt64(h))

-(x::Char, y::Char) = Int(x) - Int(y)
-(x::Char, y::Integer) = Char(Int32(x) - Int32(y))
Expand Down

0 comments on commit 463ea70

Please sign in to comment.