summaryrefslogtreecommitdiffstats
path: root/src/objcache.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2006-10-17 18:03:21 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2006-10-17 18:03:21 (GMT)
commit8a6cb1baa8edce0b56a07e97bd57f5d5dd756cb5 (patch)
tree54faf2b759aca5cdc6184168aa676ed669435766 /src/objcache.cpp
parentca720513ae89ad82fd8d8c4340271375ae1e9f64 (diff)
downloadDoxygen-8a6cb1baa8edce0b56a07e97bd57f5d5dd756cb5.zip
Doxygen-8a6cb1baa8edce0b56a07e97bd57f5d5dd756cb5.tar.gz
Doxygen-8a6cb1baa8edce0b56a07e97bd57f5d5dd756cb5.tar.bz2
Release-1.5.0
Diffstat (limited to 'src/objcache.cpp')
-rw-r--r--src/objcache.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/objcache.cpp b/src/objcache.cpp
index 63e7eb7..f45a0e7 100644
--- a/src/objcache.cpp
+++ b/src/objcache.cpp
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <assert.h>
+#include <qglobal.h>
#include "objcache.h"
//----------------------------------------------------------------------
@@ -176,11 +177,10 @@ void ObjCache::moveToFront(int index)
unsigned int ObjCache::hash(void *addr)
{
- static bool isPtr64 = sizeof(addr)==8 && sizeof(long)==8;
-
- unsigned long key = (unsigned long)addr;
+ static bool isPtr64 = sizeof(addr)==8;
if (isPtr64)
{
+ uint64 key = (uint64)addr;
// Thomas Wang's 64 bit Mix Function
key += ~(key << 32);
key ^= (key >> 22);
@@ -190,18 +190,20 @@ unsigned int ObjCache::hash(void *addr)
key ^= (key >> 15);
key += ~(key << 27);
key ^= (key >> 31);
+ return key & (m_size-1);
}
else
{
// Thomas Wang's 32 bit Mix Function
+ unsigned long key = (unsigned long)addr;
key += ~(key << 15);
key ^= (key >> 10);
key += (key << 3);
key ^= (key >> 6);
key += ~(key << 11);
key ^= (key >> 16);
+ return key & (m_size-1);
}
- return key & (m_size-1);
}
ObjCache::HashNode *ObjCache::hashFind(void *obj)