1 //===-- llvm/Support/DJB.h ---DJB Hash --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for the DJ Bernstein hash function.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_SUPPORT_DJB_H
15 #define LLVM_SUPPORT_DJB_H
17 #include "llvm/ADT/StringRef.h"
21 /// The Bernstein hash function used by the DWARF accelerator tables.
22 inline uint32_t djbHash(StringRef Buffer, uint32_t H = 5381) {
23 for (unsigned char C : Buffer.bytes())
28 /// Computes the Bernstein hash after folding the input according to the Dwarf 5
29 /// standard case folding rules.
30 uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H = 5381);
33 #endif // LLVM_SUPPORT_DJB_H