|
|
|||
File indexing completed on 2026-05-10 08:44:29
0001 //===-- llvm/Support/DJB.h ---DJB Hash --------------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file contains support for the DJ Bernstein hash function. 0010 // 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_SUPPORT_DJB_H 0014 #define LLVM_SUPPORT_DJB_H 0015 0016 #include "llvm/ADT/StringRef.h" 0017 0018 namespace llvm { 0019 0020 /// The Bernstein hash function used by the DWARF accelerator tables. 0021 inline uint32_t djbHash(StringRef Buffer, uint32_t H = 5381) { 0022 for (unsigned char C : Buffer.bytes()) 0023 H = (H << 5) + H + C; 0024 return H; 0025 } 0026 0027 /// Computes the Bernstein hash after folding the input according to the Dwarf 5 0028 /// standard case folding rules. 0029 uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H = 5381); 0030 } // namespace llvm 0031 0032 #endif // LLVM_SUPPORT_DJB_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|