LLVM 23.0.0git
xxhash.h
Go to the documentation of this file.
1/*
2 xxHash - Extremely Fast Hash algorithm
3 Header File
4 Copyright (C) 2012-2016, Yann Collet.
5
6 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are
10 met:
11
12 * Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above
15 copyright notice, this list of conditions and the following disclaimer
16 in the documentation and/or other materials provided with the
17 distribution.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 You can contact the author at :
32 - xxHash source repository : https://github.com/Cyan4973/xxHash
33*/
34
35#ifndef LLVM_SUPPORT_XXHASH_H
36#define LLVM_SUPPORT_XXHASH_H
37
39#include <cstddef>
40#include <cstdint>
41
42namespace llvm {
43
44/// XXH3's 64-bit variant. Inline ArrayRef and StringRef overloads live in
45/// llvm/ADT/ArrayRef.h and llvm/ADT/StringRef.h.
46LLVM_ABI uint64_t xxh3_64bits(const uint8_t *data, size_t len);
47
48/*-**********************************************************************
49 * XXH3 128-bit variant
50 ************************************************************************/
51
52/*!
53 * @brief The return value from 128-bit hashes.
54 *
55 * Stored in little endian order, although the fields themselves are in native
56 * endianness.
57 */
59 uint64_t low64; /*!< `value & 0xFFFFFFFFFFFFFFFF` */
60 uint64_t high64; /*!< `value >> 64` */
61
62 /// Convenience equality check operator.
63 bool operator==(const XXH128_hash_t rhs) const {
64 return low64 == rhs.low64 && high64 == rhs.high64;
65 }
66};
67
68/// XXH3's 128-bit variant. Inline ArrayRef overload lives in
69/// llvm/ADT/ArrayRef.h.
70LLVM_ABI XXH128_hash_t xxh3_128bits(const uint8_t *data, size_t len);
71
72} // namespace llvm
73
74#endif
#define LLVM_ABI
Definition Compiler.h:213
static Split data
This is an optimization pass for GlobalISel generic memory operations.
uint64_t xxh3_64bits(ArrayRef< uint8_t > data)
Inline ArrayRef overloads of the xxhash entry points declared out-of-line in llvm/Support/xxhash....
Definition ArrayRef.h:558
XXH128_hash_t xxh3_128bits(ArrayRef< uint8_t > data)
Definition ArrayRef.h:561
The return value from 128-bit hashes.
Definition xxhash.h:58
bool operator==(const XXH128_hash_t rhs) const
Convenience equality check operator.
Definition xxhash.h:63
uint64_t low64
value & 0xFFFFFFFFFFFFFFFF
Definition xxhash.h:59
uint64_t high64
value >> 64
Definition xxhash.h:60