[llvm-commits] [llvm] r144024 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
Eric Christopher
echristo at apple.com
Mon Nov 7 13:49:36 PST 2011
Author: echristo
Date: Mon Nov 7 15:49:35 2011
New Revision: 144024
URL: http://llvm.org/viewvc/llvm-project?rev=144024&view=rev
Log:
Move the hash function to using and taking a StringRef.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h?rev=144024&r1=144023&r2=144024&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h Mon Nov 7 15:49:35 2011
@@ -69,10 +69,10 @@
eHashFunctionDJB = 0u
};
- static uint32_t HashDJB (const char *s) {
+ static uint32_t HashDJB (StringRef Str) {
uint32_t h = 5381;
- for (unsigned char c = *s; c; c = *++s)
- h = ((h << 5) + h) + c;
+ for (unsigned i = 0, e = Str.size(); i != e; ++i)
+ h = ((h << 5) + h) + Str[i];
return h;
}
@@ -190,7 +190,7 @@
MCSymbol *Sym;
std::vector<uint32_t> DIEOffsets; // offsets
HashData(StringRef S) : Str(S) {
- HashValue = DwarfAccelTable::HashDJB(S.str().c_str());
+ HashValue = DwarfAccelTable::HashDJB(S);
}
void addOffset(uint32_t off) { DIEOffsets.push_back(off); }
#ifndef NDEBUG
More information about the llvm-commits
mailing list