dbertoni 2002/12/22 11:25:34
Modified: c/src/PlatformSupport XalanDOMStringHashTable.cpp
Log:
Moved hash function to XalanDOMString.
Revision Changes Path
1.7 +4 -27
xml-xalan/c/src/PlatformSupport/XalanDOMStringHashTable.cpp
Index: XalanDOMStringHashTable.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/PlatformSupport/XalanDOMStringHashTable.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanDOMStringHashTable.cpp 20 Nov 2002 02:27:13 -0000 1.6
+++ XalanDOMStringHashTable.cpp 22 Dec 2002 19:25:34 -0000 1.7
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -173,29 +173,6 @@
-inline size_t
-hashString(
- const XalanDOMChar* theString,
- XalanDOMString::size_type theLength)
-{
- assert(theString != 0);
-
- size_t theResult = 0;
-
- const XalanDOMChar* const theEnd = theString + theLength;
-
- while (theString != theEnd)
- {
- theResult += (theResult * 37) + (theResult >> 24) +
size_t(*theString);
-
- ++theString;
- }
-
- return theResult;
-}
-
-
-
const XalanDOMString*
XalanDOMStringHashTable::find(
const XalanDOMChar* theString,
@@ -207,7 +184,7 @@
const XalanDOMString::size_type theActualLength =
theLength == XalanDOMString::npos ? length(theString) :
theLength;
- const size_t theHash = hashString(theString, theActualLength);
+ const XalanDOMString::size_type theHash =
XalanDOMString::hash(theString, theActualLength);
const size_t theLocalBucketIndex = theHash % m_bucketCount;
@@ -243,7 +220,7 @@
void
XalanDOMStringHashTable::insert(const XalanDOMString& theString)
{
- const size_t theHash = hashString(c_wstr(theString),
length(theString));
+ const XalanDOMString::size_type theHash = theString.hash();
const size_t theBucketIndex = theHash % m_bucketCount;
@@ -272,7 +249,7 @@
const XalanDOMString& theString,
size_t theBucketIndex)
{
- assert(theBucketIndex == hashString(c_wstr(theString),
length(theString)) % m_bucketCount);
+ assert(theBucketIndex == theString.hash() % m_bucketCount);
assert(theBucketIndex < m_bucketCount);
BucketType& theBucket = m_buckets[theBucketIndex];
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]