[Scummvm-devel] [Scummvm-cvs-logs] SF.net SVN: scummvm:[53409] scummvm/trunk/engines/sword25/kernel

Max Horn max at quendi.de
Wed Oct 13 13:29:13 CEST 2010


Am 13.10.2010 um 13:22 schrieb drmccoy at users.sourceforge.net:

> Revision: 53409
>          http://scummvm.svn.sourceforge.net/scummvm/?rev=53409&view=rev
> Author:   drmccoy
> Date:     2010-10-13 11:22:19 +0000 (Wed, 13 Oct 2010)
> 
> Log Message:
> -----------
> SWORD25: Cast the pointer to unsigned long long
> 
> ...Instead of to uint, which fails on my 64 bit system where pointers
> are 64 bit, but normal ints 32 bit wide.
> 

But this will then in turn fail on systems that don't support "long long".

Note that we really only need a hash value, so the lower 32bit of those pointers should be fine. So, something like the following dirty hack should be slightly more portable, but of course it'll still be a *dirty* hack. Then again, storing pointers in a hashmap seems like a dirty hack to me, too...

  return  *(uint *)&x


Bye,
Max

> Modified Paths:
> --------------
>    scummvm/trunk/engines/sword25/kernel/callbackregistry.h
>    scummvm/trunk/engines/sword25/kernel/objectregistry.h
> 
> Modified: scummvm/trunk/engines/sword25/kernel/callbackregistry.h
> ===================================================================
> --- scummvm/trunk/engines/sword25/kernel/callbackregistry.h	2010-10-13 11:20:49 UTC (rev 53408)
> +++ scummvm/trunk/engines/sword25/kernel/callbackregistry.h	2010-10-13 11:22:19 UTC (rev 53409)
> @@ -74,8 +74,8 @@
> 		}
> 	};
> 	struct CallbackPtr_Hash {
> -		uint operator()(CallbackPtr x) const {
> -			return (uint)x;
> +		unsigned long long operator()(CallbackPtr x) const {
> +			return (unsigned long long)x;
> 		}
> 	};
> 
> 
> Modified: scummvm/trunk/engines/sword25/kernel/objectregistry.h
> ===================================================================
> --- scummvm/trunk/engines/sword25/kernel/objectregistry.h	2010-10-13 11:20:49 UTC (rev 53408)
> +++ scummvm/trunk/engines/sword25/kernel/objectregistry.h	2010-10-13 11:22:19 UTC (rev 53409)
> @@ -136,8 +136,8 @@
> 		}
> 	};
> 	struct ClassPointer_Hash {
> -		uint operator()(const T *x) const {
> -			return (uint)x;
> +		unsigned long long operator()(const T *x) const {
> +			return (unsigned long long)x;
> 		}
> 	};
> 
> 
> 
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Scummvm-cvs-logs mailing list
> Scummvm-cvs-logs at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scummvm-cvs-logs
> 





More information about the Scummvm-devel mailing list