LLVM
17.0.0git
include
llvm
Support
DJB.h
Go to the documentation of this file.
1
//===-- llvm/Support/DJB.h ---DJB Hash --------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file contains support for the DJ Bernstein hash function.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_SUPPORT_DJB_H
14
#define LLVM_SUPPORT_DJB_H
15
16
#include "
llvm/ADT/StringRef.h
"
17
18
namespace
llvm
{
19
20
/// The Bernstein hash function used by the DWARF accelerator tables.
21
inline
uint32_t
djbHash
(
StringRef
Buffer,
uint32_t
H
= 5381) {
22
for
(
unsigned
char
C
: Buffer.
bytes
())
23
H
= (
H
<< 5) +
H
+
C
;
24
return
H
;
25
}
26
27
/// Computes the Bernstein hash after folding the input according to the Dwarf 5
28
/// standard case folding rules.
29
uint32_t
caseFoldingDjbHash
(StringRef Buffer,
uint32_t
H
= 5381);
30
}
// namespace llvm
31
32
#endif // LLVM_SUPPORT_DJB_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
StringRef.h
C
(vector float) vec_cmpeq(*A, *B) C
Definition:
README_ALTIVEC.txt:86
llvm::caseFoldingDjbHash
uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H=5381)
Computes the Bernstein hash after folding the input according to the Dwarf 5 standard case folding ru...
Definition:
DJB.cpp:72
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:50
uint32_t
H
#define H(x, y, z)
Definition:
MD5.cpp:57
llvm::StringRef::bytes
iterator_range< const unsigned char * > bytes() const
Definition:
StringRef.h:121
llvm::djbHash
uint32_t djbHash(StringRef Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
Definition:
DJB.h:21
Generated on Sat Jan 28 2023 08:50:38 for LLVM by
1.8.17