diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2005-11-28 09:51:54 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2005-11-28 09:51:54 +0300 |
commit | e1c66eb14509c9f6f4c59edd8a541e3d49d90cef (patch) | |
tree | 3237f6c534b1e7a5a801bb327f55de35425ff5e4 /source/gameengine/Expressions | |
parent | 427cae9eebaceeac80f8e7a151661aa36f18db01 (diff) |
applied the 64-bit pointer patch submitted by Ken Hughes
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r-- | source/gameengine/Expressions/KX_HashedPtr.cpp | 15 | ||||
-rw-r--r-- | source/gameengine/Expressions/KX_HashedPtr.h | 2 |
2 files changed, 11 insertions, 6 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); } diff --git a/source/gameengine/Expressions/KX_HashedPtr.h b/source/gameengine/Expressions/KX_HashedPtr.h index 18d183c2ae8..06e86854d82 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.h +++ b/source/gameengine/Expressions/KX_HashedPtr.h @@ -32,7 +32,7 @@ #ifndef __KX_HASHEDPTR #define __KX_HASHEDPTR -unsigned int KX_Hash(unsigned int inDWord); +unsigned int KX_Hash(void * inDWord); class CHashedPtr { |