[llvm-commits] CVS: llvm/lib/Support/CStringMap.cpp

Chris Lattner sabre at nondot.org
Sat Jan 6 15:19:57 PST 2007



Changes in directory llvm/lib/Support:

CStringMap.cpp updated: 1.1 -> 1.2
---
Log message:

add a note


---
Diffs of the changes:  (+4 -1)

 CStringMap.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Support/CStringMap.cpp
diff -u llvm/lib/Support/CStringMap.cpp:1.1 llvm/lib/Support/CStringMap.cpp:1.2
--- llvm/lib/Support/CStringMap.cpp:1.1	Sun Oct 29 17:42:03 2006
+++ llvm/lib/Support/CStringMap.cpp	Sat Jan  6 17:19:38 2007
@@ -33,8 +33,11 @@
 /// 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);






More information about the llvm-commits mailing list