WPILibC++
2023.4.3-108-ge5452e3
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
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 Jul 10 2023 17:03:01 for WPILibC++ by
1.9.4