From 5803a6744e0623ca72bcb9d0535ef7fd0e3b8163 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 24 Jan 2018 16:53:14 +0000 Subject: [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 --- llvm/lib/BinaryFormat/Dwarf.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/BinaryFormat/Dwarf.cpp') 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; -- cgit v1.2.3