Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2180)

Unified Diff: Source/wtf/HashFunctions.h

Issue 373423003: Save 100-300 KB footprint by not force inlining HashTable functions Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Non-inlined HashTable: Rebased to newer origin/master Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/HashCountedSet.h ('k') | Source/wtf/HashMap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashFunctions.h
diff --git a/Source/wtf/HashFunctions.h b/Source/wtf/HashFunctions.h
index 522bfd776bb8814e37d6574b3229618097048ef9..20bedcd91b6ead4138f9c31012198dfbdba4287a 100644
--- a/Source/wtf/HashFunctions.h
+++ b/Source/wtf/HashFunctions.h
@@ -37,68 +37,19 @@ namespace WTF {
// integer hash function
// Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
- inline unsigned intHash(uint8_t key8)
- {
- unsigned key = key8;
- key += ~(key << 15);
- key ^= (key >> 10);
- key += (key << 3);
- key ^= (key >> 6);
- key += ~(key << 11);
- key ^= (key >> 16);
- return key;
- }
+ unsigned intHash(uint8_t key8);
// Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
- inline unsigned intHash(uint16_t key16)
- {
- unsigned key = key16;
- key += ~(key << 15);
- key ^= (key >> 10);
- key += (key << 3);
- key ^= (key >> 6);
- key += ~(key << 11);
- key ^= (key >> 16);
- return key;
- }
+ unsigned intHash(uint16_t key16);
// Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
- inline unsigned intHash(uint32_t key)
- {
- key += ~(key << 15);
- key ^= (key >> 10);
- key += (key << 3);
- key ^= (key >> 6);
- key += ~(key << 11);
- key ^= (key >> 16);
- return key;
- }
+ unsigned intHash(uint32_t key);
// Thomas Wang's 64 bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
- inline unsigned intHash(uint64_t key)
- {
- key += ~(key << 32);
- key ^= (key >> 22);
- key += ~(key << 13);
- key ^= (key >> 8);
- key += (key << 3);
- key ^= (key >> 15);
- key += ~(key << 27);
- key ^= (key >> 31);
- return static_cast<unsigned>(key);
- }
+ unsigned intHash(uint64_t key);
// Compound integer hash method: http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000
- inline unsigned pairIntHash(unsigned key1, unsigned key2)
- {
- unsigned shortRandom1 = 277951225; // A random 32-bit value.
- unsigned shortRandom2 = 95187966; // A random 32-bit value.
- uint64_t longRandom = 19248658165952622LL; // A random 64-bit value.
-
- uint64_t product = longRandom * (shortRandom1 * key1 + shortRandom2 * key2);
- unsigned highBits = static_cast<unsigned>(product >> (sizeof(uint64_t) - sizeof(unsigned)));
- return highBits;
- }
+ unsigned pairIntHash(unsigned key1, unsigned key2);
template<typename T> struct IntHash {
static unsigned hash(T key) { return intHash(static_cast<typename IntTypes<sizeof(T)>::UnsignedType>(key)); }
« no previous file with comments | « Source/wtf/HashCountedSet.h ('k') | Source/wtf/HashMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698