[Bf-committers] build error amd64

Ton Roosendaal ton at blender.org
Sat Nov 26 13:31:20 CET 2005


Hi,

The module source/kernel/ is a bit a misleading module name... it was  
created for the game engine, and contains code I've never really looked  
at. :)

Whether or not the game engine (solid, sumo, bullet) is 64 bits  
compliant code I really don't know. Anyhoo, the code as described below  
looks fine to me!

-Ton-

On 25 Nov, 2005, at 18:32, Ken Hughes wrote:

> Mats Holmberg wrote:
>> Ken Hughes wrote:
>>> Mats Holmberg wrote:
>>>
>>>> Hi,
>>>>
>>>> trying to build on my new amd64 system ends in the following:
>>>>  ......
>>>
>>> Ive got a commit for this ready, but wanted to talk to Ton first.   
>>> In the meantime, check #3264 in the bug tracker.  You can apply the  
>>> patch there and it will build.
>>>
>>> Ken
>>>
>> Ok, thanks for that! I'll hold..
>
> Since Ton isn't around on IRC, maybe he'll read this so I can do a  
> commit:
>
> The compiler error in source/kernel/gen_system/GEN_HashedPtr.cpp is  
> caused by a function which is generating a hash key for an array index  
> from a pointer.  It seems safe for now to let the hash function work  
> on either a 32-bit or 64-bit pointer (since it's hashing the lower  
> bits of the larger pointer, which should still vary enough to give a  
> good result).
>
> My proposed patch casts the pointer to a matching-sized long object,  
> then masks and returns the lower 32-bits.  It should also work under  
> 64-bit Windows, at least until 64-bit cygwin support exists.  Roughly  
> speaking here's the proposed code:
>
> new in source/kernel/gen_system/GEN_HashedPtr.cpp:
> ----------------
> unsigned int GEN_Hash(void * 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 (unsigned int)(key & 0xffffffff);
> }
> ----------------
>
> new source/kernel/gen_system/GEN_HashedPtr.h:
>
> ----------------
> unsigned int GEN_Hash(void * inDWord);
> ----------------
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list