DescriptionAdd methods for hashing pairs of integer values.
This will allow us to create hash_maps that are keyed off of std::pair objects
holding two integer values.
When both integers are at most 32-bits we can use 64-bit multiplication to
efficiently find the hash code. When one of the integers is 64-bit, then
we split the two values in the pair into 4 32-bit integers.
References to the algorithms used are contained in comments within the code.
These algorithms are similar to the hash function recently added to WebKit
in https://bugs.webkit.org/show_bug.cgi?id=96022, however since our hash codes
are of type size_t (theirs are unsigned) which is 64 bits large on some
platforms, we can be more efficient and not have to reduce the hash code to 32
bits on some platforms.
Tested by cc_unittests: HashPairTest.IntegerPairs.
BUG=149870
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=158479
Patch Set 1 #Patch Set 2 : odd where needed #Patch Set 3 : fix build on some platforms #Patch Set 4 : fix windows compile #
Total comments: 2
Patch Set 5 : Proper implementation of multiply-add hashing #Patch Set 6 : current-windows-attempt #Patch Set 7 : compiles at last #
Total comments: 3
Patch Set 8 : #Patch Set 9 : #
Messages
Total messages: 13 (0 generated)
|