Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/evas

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


Modified Files:
        evas_stringshare.c 


Log Message:
Use a djb2 hash for a better distribution.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/data/evas_stringshare.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- evas_stringshare.c  1 Dec 2005 03:47:14 -0000       1.6
+++ evas_stringshare.c  5 Dec 2005 02:51:10 -0000       1.7
@@ -18,11 +18,11 @@
 static inline int
 _evas_stringshare_hash_gen(const char *str, int *len)
 {
-   unsigned int hash_num = 0, i;
+   unsigned int hash_num = 5381, i;
    const unsigned char *ptr;
 
    for (i = 0, ptr = (unsigned char *)str; *ptr; ptr++, i++)
-     hash_num ^= ((int)(*ptr) | ((int)(*ptr) << 8)) >> (i % 8);
+     hash_num = (hash_num * 33) ^ *ptr;
 
    hash_num &= 0xff;
    *len = i;




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to