Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1899)

Unified Diff: Source/wtf/StringHasher.h

Issue 328453003: Refactor to remove unnecessary code from the string hashing functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the unit tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/StringHasherTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/StringHasher.h
diff --git a/Source/wtf/StringHasher.h b/Source/wtf/StringHasher.h
index 7c0f92a0f7aa85e5b157d2c16c4890af2923da03..6a2527ebcc07e6a96cc54570b852fe4b8e691a41 100644
--- a/Source/wtf/StringHasher.h
+++ b/Source/wtf/StringHasher.h
@@ -109,25 +109,6 @@ public:
addCharactersAssumingAligned<T, defaultConverter>(data, length);
}
- template<typename T, UChar Converter(T)> void addCharactersAssumingAligned(const T* data)
- {
- ASSERT(!m_hasPendingCharacter);
-
- while (T a = *data++) {
- T b = *data++;
- if (!b) {
- addCharacter(Converter(a));
- break;
- }
- addCharactersAssumingAligned(Converter(a), Converter(b));
- }
- }
-
- template<typename T> void addCharactersAssumingAligned(const T* data)
- {
- addCharactersAssumingAligned<T, defaultConverter>(data);
- }
-
template<typename T, UChar Converter(T)> void addCharacters(const T* data, unsigned length)
{
if (m_hasPendingCharacter && length) {
@@ -143,20 +124,6 @@ public:
addCharacters<T, defaultConverter>(data, length);
}
- template<typename T, UChar Converter(T)> void addCharacters(const T* data)
- {
- if (m_hasPendingCharacter && *data) {
- m_hasPendingCharacter = false;
- addCharactersAssumingAligned(m_pendingCharacter, Converter(*data++));
- }
- addCharactersAssumingAligned<T, Converter>(data);
- }
-
- template<typename T> void addCharacters(const T* data)
- {
- addCharacters<T, defaultConverter>(data);
- }
-
unsigned hashWithTop8BitsMasked() const
{
unsigned result = avalancheBits();
@@ -196,23 +163,11 @@ public:
return hasher.hashWithTop8BitsMasked();
}
- template<typename T, UChar Converter(T)> static unsigned computeHashAndMaskTop8Bits(const T* data)
- {
- StringHasher hasher;
- hasher.addCharactersAssumingAligned<T, Converter>(data);
- return hasher.hashWithTop8BitsMasked();
- }
-
template<typename T> static unsigned computeHashAndMaskTop8Bits(const T* data, unsigned length)
{
return computeHashAndMaskTop8Bits<T, defaultConverter>(data, length);
}
- template<typename T> static unsigned computeHashAndMaskTop8Bits(const T* data)
- {
- return computeHashAndMaskTop8Bits<T, defaultConverter>(data);
- }
-
template<typename T, UChar Converter(T)> static unsigned computeHash(const T* data, unsigned length)
{
StringHasher hasher;
@@ -220,23 +175,11 @@ public:
return hasher.hash();
}
- template<typename T, UChar Converter(T)> static unsigned computeHash(const T* data)
- {
- StringHasher hasher;
- hasher.addCharactersAssumingAligned<T, Converter>(data);
- return hasher.hash();
- }
-
template<typename T> static unsigned computeHash(const T* data, unsigned length)
{
return computeHash<T, defaultConverter>(data, length);
}
- template<typename T> static unsigned computeHash(const T* data)
- {
- return computeHash<T, defaultConverter>(data);
- }
-
static unsigned hashMemory(const void* data, unsigned length)
{
// FIXME: Why does this function use the version of the hash that drops the top 8 bits?
« no previous file with comments | « no previous file | Source/wtf/StringHasherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698