Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2005-11-28 09:51:54 +0300
committerErwin Coumans <blender@erwincoumans.com>2005-11-28 09:51:54 +0300
commite1c66eb14509c9f6f4c59edd8a541e3d49d90cef (patch)
tree3237f6c534b1e7a5a801bb327f55de35425ff5e4 /source/gameengine/Expressions/KX_HashedPtr.cpp
parent427cae9eebaceeac80f8e7a151661aa36f18db01 (diff)
applied the 64-bit pointer patch submitted by Ken Hughes
Diffstat (limited to 'source/gameengine/Expressions/KX_HashedPtr.cpp')
-rw-r--r--source/gameengine/Expressions/KX_HashedPtr.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp
index d01ff1626d7..b1eeff20766 100644
--- a/source/gameengine/Expressions/KX_HashedPtr.cpp
+++ b/source/gameengine/Expressions/KX_HashedPtr.cpp
@@ -35,18 +35,23 @@
#include <config.h>
#endif
-unsigned int KX_Hash(unsigned int inDWord)
+unsigned int KX_Hash(void * inDWord)
{
- unsigned int key = inDWord;
+#if defined(_WIN64)
+ unsigned __int64 key = (unsigned __int64)inDWord;
+#else
+ unsigned long key = (unsigned long)inDWord;
+#endif
+
key += ~(key << 16);
key ^= (key >> 5);
key += (key << 3);
key ^= (key >> 13);
key += ~(key << 9);
key ^= (key >> 17);
- return key;
-};
+ return (unsigned int)(key & 0xffffffff);
+}
CHashedPtr::CHashedPtr(void* val) : m_valptr(val)
@@ -57,5 +62,5 @@ CHashedPtr::CHashedPtr(void* val) : m_valptr(val)
unsigned int CHashedPtr::hash() const
{
- return KX_Hash((unsigned int) m_valptr);
+ return KX_Hash(m_valptr);
}