diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-06 23:19:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-06 23:19:38 +0000 |
commit | 38742b9603858db660cbb6b67853ca9266eaa196 (patch) | |
tree | 3e4f2a5f5cbe2fc5cef1bd84e87144b2316d1a18 /lib/Support | |
parent | 15c91887e47f7301255d838c4706509fe8677faa (diff) | |
download | external_llvm-38742b9603858db660cbb6b67853ca9266eaa196.zip external_llvm-38742b9603858db660cbb6b67853ca9266eaa196.tar.gz external_llvm-38742b9603858db660cbb6b67853ca9266eaa196.tar.bz2 |
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/CStringMap.cpp | 5 | ||||
-rw-r--r-- | lib/Support/StringMap.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/Support/CStringMap.cpp b/lib/Support/CStringMap.cpp index 3229bfe..6cd3745 100644 --- a/lib/Support/CStringMap.cpp +++ b/lib/Support/CStringMap.cpp @@ -33,8 +33,11 @@ CStringMapImpl::CStringMapImpl(unsigned InitSize, unsigned itemSize) { /// HashString - Compute a hash code for the specified string. /// static unsigned HashString(const char *Start, const char *End) { + // Bernstein hash function. unsigned int Result = 0; - // Perl hash function. + // TODO: investigate whether a modified bernstein hash function performs + // better: http://eternallyconfuzzled.com/tuts/hashing.html#existing + // X*33+c -> X*33^c while (Start != End) Result = Result * 33 + *Start++; Result = Result + (Result >> 5); diff --git a/lib/Support/StringMap.cpp b/lib/Support/StringMap.cpp index 3229bfe..6cd3745 100644 --- a/lib/Support/StringMap.cpp +++ b/lib/Support/StringMap.cpp @@ -33,8 +33,11 @@ CStringMapImpl::CStringMapImpl(unsigned InitSize, unsigned itemSize) { /// HashString - Compute a hash code for the specified string. /// static unsigned HashString(const char *Start, const char *End) { + // Bernstein hash function. unsigned int Result = 0; - // Perl hash function. + // TODO: investigate whether a modified bernstein hash function performs + // better: http://eternallyconfuzzled.com/tuts/hashing.html#existing + // X*33+c -> X*33^c while (Start != End) Result = Result * 33 + *Start++; Result = Result + (Result >> 5); |