diff options
author | Rui Ueyama <ruiu@google.com> | 2018-03-02 22:00:38 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2018-03-02 22:00:38 +0000 |
commit | e403c862cc0788236269730e272c91fec74c4a9a (patch) | |
tree | d97f7f4347b23fd2475b7e1e464f5b747bb6a46f /llvm/lib/Support/DJB.cpp | |
parent | cbf060f9dd903aad4fb538c7a5d5133c9dc8e71f (diff) | |
download | bcm5719-llvm-e403c862cc0788236269730e272c91fec74c4a9a.tar.gz bcm5719-llvm-e403c862cc0788236269730e272c91fec74c4a9a.zip |
Make llvm::djbHash an inline function.
Differential Revision: https://reviews.llvm.org/D43644
llvm-svn: 326625
Diffstat (limited to 'llvm/lib/Support/DJB.cpp')
-rw-r--r-- | llvm/lib/Support/DJB.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/llvm/lib/Support/DJB.cpp b/llvm/lib/Support/DJB.cpp index b7bfbbf7bd8..905dcf1b7e8 100644 --- a/llvm/lib/Support/DJB.cpp +++ b/llvm/lib/Support/DJB.cpp @@ -19,16 +19,6 @@ using namespace llvm; -static inline uint32_t djbHashChar(unsigned char C, uint32_t H) { - return (H << 5) + H + C; -} - -uint32_t llvm::djbHash(StringRef Buffer, uint32_t H) { - for (unsigned char C : Buffer.bytes()) - H = djbHashChar(C, H); - return H; -} - static UTF32 chopOneUTF32(StringRef &Buffer) { UTF32 C; const UTF8 *const Begin8Const = @@ -86,7 +76,7 @@ uint32_t llvm::caseFoldingDjbHash(StringRef Buffer, uint32_t H) { // This is by far the most common case, so handle this specially. if (C >= 'A' && C <= 'Z') C = 'a' + (C - 'A'); // fold uppercase into lowercase - H = djbHashChar(C, H); + H = (H << 5) + H + C; Buffer = Buffer.drop_front(); continue; } |