[webkit-reviews] review requested: [Bug 45970] Add StringHasher class : [Attachment 67916] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 17 10:23:57 PDT 2010
Patrick R. Gansterer <paroga at paroga.com> has asked for review:
Bug 45970: Add StringHasher class
https://bugs.webkit.org/show_bug.cgi?id=45970
Attachment 67916: Patch
https://bugs.webkit.org/attachment.cgi?id=67916&action=review
------- Additional Comments from Patrick R. Gansterer <paroga at paroga.com>
> + if (m_cachedCharacter != invalidCharacterValue) {
> + addCharactersToHash(m_cachedCharacter, ch);
> + m_cachedCharacter = invalidCharacterValue;
> + return;
> + }
Will be used later in the UTF8 to hash function to add each single character
(avoids caching there).
> - hash &= 0x7fffffff;
> -
> - // this avoids ever returning a hash code of 0, since that is used to
> - // signal "hash not computed yet", using a value that is likely to be
> - // effectively the same as 0 when the low bits are masked
> - if (hash == 0)
> - hash = 0x40000000;
> + if (!result)
> + return 0x80000000;
This is the same algorithm as in StringHash.h.
> + template<typename T, UChar Coverter(T)> static inline unsigned
createHash(const T* data, unsigned length)
"UChar Coverter(T)" will be used later in CaseFoldingHash::hash to do a
createHash<UChar, WTF::Unicode::foldCase>().
More information about the webkit-reviews
mailing list