forked from OSchip/llvm-project
[NFC] Make magic number for DJB hash function customizable.
This allows us to specify the magic number for the DJB hash function. This feature is needed by dsymutil to emit Apple types accelerator table. llvm-svn: 323341
This commit is contained in:
parent
d5a56e48b9
commit
5803a6744e
|
@ -526,7 +526,7 @@ private:
|
||||||
enum DwarfFormat : uint8_t { DWARF32, DWARF64 };
|
enum DwarfFormat : uint8_t { DWARF32, DWARF64 };
|
||||||
|
|
||||||
/// The Bernstein hash function used by the accelerator tables.
|
/// The Bernstein hash function used by the accelerator tables.
|
||||||
uint32_t djbHash(StringRef Buffer);
|
uint32_t djbHash(StringRef Buffer, uint32_t H = 5381);
|
||||||
|
|
||||||
} // End of namespace dwarf
|
} // End of namespace dwarf
|
||||||
|
|
||||||
|
|
|
@ -587,8 +587,7 @@ bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
|
||||||
return ExtensionsOk;
|
return ExtensionsOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t llvm::dwarf::djbHash(StringRef Buffer) {
|
uint32_t llvm::dwarf::djbHash(StringRef Buffer, uint32_t H) {
|
||||||
uint32_t H = 5381;
|
|
||||||
for (char C : Buffer.bytes())
|
for (char C : Buffer.bytes())
|
||||||
H = ((H << 5) + H) + C;
|
H = ((H << 5) + H) + C;
|
||||||
return H;
|
return H;
|
||||||
|
|
Loading…
Reference in New Issue