|
From: <axl...@us...> - 2010-05-18 20:22:15
|
Revision: 740
http://hgengine.svn.sourceforge.net/hgengine/?rev=740&view=rev
Author: axlecrusher
Date: 2010-05-18 20:22:07 +0000 (Tue, 18 May 2010)
Log Message:
-----------
Try new hash function
Modified Paths:
--------------
Mercury2/src/MercuryString.cpp
Modified: Mercury2/src/MercuryString.cpp
===================================================================
--- Mercury2/src/MercuryString.cpp 2010-05-18 20:21:39 UTC (rev 739)
+++ Mercury2/src/MercuryString.cpp 2010-05-18 20:22:07 UTC (rev 740)
@@ -348,7 +348,7 @@
}
unsigned int MString::hash() const
-{
+{/*
unsigned int ret = 0;
unsigned int i;
unsigned int j = size()>>2;
@@ -359,6 +359,15 @@
ret += (unsigned int)(unsigned char)m_sCur[i];
return ret;
+ */
+ unsigned long hash = 5381;
+ int c;
+ unsigned char* s = (unsigned char*)m_sCur;
+
+ while ( (c = *s++) )
+ hash = hash * 33 ^ c;
+
+ return hash;
}
void MString::resize( unsigned int size )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|