diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2005-05-08 21:32:24 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2005-05-08 21:32:24 (GMT) |
commit | 5bd970b12ec39636593453d12e5b64bd935bbf38 (patch) | |
tree | c4bbe961812e7008b9e85fd820596290c043c0f6 /src/searchindex.cpp | |
parent | 4a8c2f5c896a1883a0611d972952a68498002ae5 (diff) | |
download | Doxygen-5bd970b12ec39636593453d12e5b64bd935bbf38.zip Doxygen-5bd970b12ec39636593453d12e5b64bd935bbf38.tar.gz Doxygen-5bd970b12ec39636593453d12e5b64bd935bbf38.tar.bz2 |
Release-1.4.2-20050508
Diffstat (limited to 'src/searchindex.cpp')
-rw-r--r-- | src/searchindex.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 5bf510f..400702b 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -80,20 +80,22 @@ static int charsToIndex(const char *word) { if (word==0) return -1; - register ushort h=0; - const char *k = word; - ushort mask=0xfc00; - while ( *k ) - { - h = (h&mask)^(h<<6)^(*k++); - } + // Fast string hashing algorithm + //register ushort h=0; + //const char *k = word; + //ushort mask=0xfc00; + //while ( *k ) + //{ + // h = (h&mask)^(h<<6)^(*k++); + //} + //return h; - //uint c1=word[0]; - //if (c1==0) return -1; - //uint c2=word[1]; - //if (c2==0) return -1; - //return c1*256+c2; - return h; + // Simple hashing that allows for substring searching + uint c1=word[0]; + if (c1==0) return -1; + uint c2=word[1]; + if (c2==0) return -1; + return c1*256+c2; } void SearchIndex::addWord(const char *word,bool hiPriority) |