Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/data


Modified Files:
        evas_hash.c 


Log Message:


make hash fn a bit better

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/data/evas_hash.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_hash.c 22 May 2005 02:49:36 -0000      1.9
+++ evas_hash.c 26 May 2005 06:15:33 -0000      1.10
@@ -9,12 +9,13 @@
 static int
 evas_hash_gen(const char *key)
 {
-   unsigned int hash_num = 0;
+   unsigned int hash_num = 0, i;
    const unsigned char *ptr;
 
    if (!key) return 0;
 
-   for (ptr = (unsigned char *)key; *ptr; ptr++) hash_num ^= (int)(*ptr);
+   for (i = 0, ptr = (unsigned char *)key; *ptr; ptr++, i++)
+     hash_num ^= ((int)(*ptr) | ((int)(*ptr) << 8)) >> (i % 8);
 
    hash_num &= 0xff;
    return (int)hash_num;




-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to