While I'm fixing some compilation warnings in ewl on 64-bit archs, I wonder if the ecore_direct_hash() function works correct or if it needs some adjustments on 64-bit archs. I attached a little patch, which takes care for 64-bit pointer size. Since I haven't got a 64-bit PC, I ask you if the patch is right.

Thanks,
Peter
Index: ecore_value.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_value.c,v
retrieving revision 1.12
diff -u -r1.12 ecore_value.c
--- ecore_value.c	17 May 2008 03:19:38 -0000	1.12
+++ ecore_value.c	14 Jul 2008 19:31:10 -0000
@@ -27,6 +27,7 @@
 #include "Ecore.h"
 #include "Ecore_Data.h"
 #include "ecore_private.h"
+#include <limits.h>
 
 EAPI const unsigned int ecore_prime_table[] =
 {
@@ -56,7 +57,13 @@
 EAPI unsigned int 
 ecore_direct_hash(const void *key)
 {
-   return ((unsigned int) key);
+#if defined(__LP64__) && UINT_MAX != ULONG_MAX
+   unsigned long int val = (unsigned long int)key;
+
+   return (unsigned int) ((val >> 32) ^ val);
+#else
+   return (unsigned int) key;
+#endif
 }
 
 /**
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to