Added nsStr (nsString, nsString2) code for counting strings that have been seen. r=rickg
git-svn-id: svn://10.0.0.236/trunk@54036 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -269,29 +269,7 @@ nsStringKey::~nsStringKey(void)
|
||||
|
||||
PRUint32 nsStringKey::HashValue(void) const
|
||||
{
|
||||
if(mStr.IsUnicode())
|
||||
{
|
||||
PRUint32 h;
|
||||
PRUint32 n;
|
||||
PRUint32 m;
|
||||
const PRUnichar* c;
|
||||
|
||||
h = 0;
|
||||
n = mStr.Length();
|
||||
c = mStr.GetUnicode();
|
||||
if(n < 16)
|
||||
{ /* Hash every char in a short string. */
|
||||
for(; n; c++, n--)
|
||||
h = (h >> 28) ^ (h << 4) ^ *c;
|
||||
}
|
||||
else
|
||||
{ /* Sample a la jave.lang.String.hash(). */
|
||||
for(m = n / 8; n >= m; c += m, n -= m)
|
||||
h = (h >> 28) ^ (h << 4) ^ *c;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
return (PRUint32)PL_HashString((const void*) mStr.GetBuffer());
|
||||
return nsStr::HashCode(mStr);
|
||||
}
|
||||
|
||||
PRBool nsStringKey::Equals(const nsHashKey* aKey) const
|
||||
|
||||
Reference in New Issue
Block a user