diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-11-27 06:47:17 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-11-27 06:47:17 +0300 |
commit | f08200baa9a3306fc4662313bd5c99ecdedf84cf (patch) | |
tree | ffa4261332059255a848cff1d9fa09776964382a /source/kernel/gen_system/GEN_HashedPtr.cpp | |
parent | bc293ba7e105f7648cb7bfa12dd90588093973dd (diff) |
-- Change to make blender with game engine disabled build without errors
on 64-bit machines.
This code only seems to be used by the game engine anyway; maybe it's
only linux which always compiles it regardless of whether game engine is
enabled?
Diffstat (limited to 'source/kernel/gen_system/GEN_HashedPtr.cpp')
-rw-r--r-- | source/kernel/gen_system/GEN_HashedPtr.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp index f852530fa53..4da40e6696d 100644 --- a/source/kernel/gen_system/GEN_HashedPtr.cpp +++ b/source/kernel/gen_system/GEN_HashedPtr.cpp @@ -36,9 +36,19 @@ #include <config.h> #endif -unsigned int GEN_Hash(unsigned int inDWord) +// +// Build hash index from pointer. Even though the final result +// is a 32-bit integer, use all the bits of the pointer as long +// as possible. +// + +unsigned int GEN_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); @@ -47,5 +57,5 @@ unsigned int GEN_Hash(unsigned int inDWord) key += ~(key << 9); key ^= (key >> 17); - return key; + return (unsigned int)(key & 0xffffffff); } |