mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[Support] Move DJB hash to support. NFC
This patch moves the DJB hash to support. This is consistent with other hashing algorithms living there. The hash is used by the DWARF accelerator tables. We're doing this now because the hashing function is needed by dsymutil and we don't want to link against libBinaryFormat. Differential revision: https://reviews.llvm.org/D42594 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323616 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//===-- Support/DJB.cpp ---DJB Hash -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains support for the DJ Bernstein hash function.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/DJB.h"
|
||||
|
||||
uint32_t llvm::djbHash(StringRef Buffer, uint32_t H) {
|
||||
for (char C : Buffer.bytes())
|
||||
H = ((H << 5) + H) + C;
|
||||
return H;
|
||||
}
|
||||
Reference in New Issue
Block a user