WPILibC++
2023.4.3
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 WPIUTIL_WPI_DJB_H
14
#define WPIUTIL_WPI_DJB_H
15
16
#include <string_view>
17
18
namespace
wpi
{
19
20
/// The Bernstein hash function used by the DWARF accelerator tables.
21
inline
uint32_t
djbHash
(
std::string_view
Buffer,
uint32_t
H = 5381) {
22
for
(
unsigned
char
C : Buffer)
23
H = (H << 5) + H + C;
24
return
H;
25
}
26
27
}
// namespace wpi
28
29
#endif
// WPIUTIL_WPI_DJB_H
string_view
basic_string_view< char > string_view
Definition:
core.h:520
Eigen::numext::uint32_t
::uint32_t uint32_t
Definition:
Meta.h:56
wpi
/file This file defines the SmallVector class.
Definition:
AprilTagFieldLayout.h:18
wpi::djbHash
uint32_t djbHash(std::string_view Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
Definition:
DJB.h:21
thirdparty
llvm
include
wpi
DJB.h
Generated on Mon Mar 27 2023 03:33:34 for WPILibC++ by
1.9.4