From e7a765c9ad82e7c52661ebd143f30ef827e1f7cb Mon Sep 17 00:00:00 2001 From: "danakj@chromium.org" Date: Tue, 25 Sep 2012 01:05:00 +0000 Subject: Add 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 Review URL: https://chromiumcodereview.appspot.com/10911330 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158479 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/cc_tests.gyp | 1 + 1 file changed, 1 insertion(+) (limited to 'cc/cc_tests.gyp') diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 8d9800c..8b724e7 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -7,6 +7,7 @@ 'chromium_code': 0, 'use_libcc_for_compositor%': 0, 'cc_tests_source_files': [ + 'hash_pair_unittest.cc', 'CCActiveAnimationTest.cpp', 'CCDamageTrackerTest.cpp', 'CCDelayBasedTimeSourceTest.cpp', -- cgit v1.1