diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-01-24 16:53:14 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-01-24 16:53:14 +0000 |
| commit | 5803a6744e0623ca72bcb9d0535ef7fd0e3b8163 (patch) | |
| tree | cb6923cf780a60e93ac219ea3ab95f8fc8bbff0d | |
| parent | d5a56e48b9993629e85029750ba7cf1020bc96d5 (diff) | |
| download | bcm5719-llvm-5803a6744e0623ca72bcb9d0535ef7fd0e3b8163.tar.gz bcm5719-llvm-5803a6744e0623ca72bcb9d0535ef7fd0e3b8163.zip | |
[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
| -rw-r--r-- | llvm/include/llvm/BinaryFormat/Dwarf.h | 2 | ||||
| -rw-r--r-- | llvm/lib/BinaryFormat/Dwarf.cpp | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h index 6e2b2ce093c..3f2d328b915 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -526,7 +526,7 @@ private: enum DwarfFormat : uint8_t { DWARF32, DWARF64 }; /// 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 diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp index 593ce7a1965..74f86a84a98 100644 --- a/llvm/lib/BinaryFormat/Dwarf.cpp +++ b/llvm/lib/BinaryFormat/Dwarf.cpp @@ -587,8 +587,7 @@ bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version, return ExtensionsOk; } -uint32_t llvm::dwarf::djbHash(StringRef Buffer) { - uint32_t H = 5381; +uint32_t llvm::dwarf::djbHash(StringRef Buffer, uint32_t H) { for (char C : Buffer.bytes()) H = ((H << 5) + H) + C; return H; |

