ATLAS Offline Software
Loading...
Searching...
No Matches
XXH.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 * Copyright (C) 2023 CERN for the benefit of the ATLAS collaboration.
4 */
11#ifndef CXXUTILS_XXH_H
12#define CXXUTILS_XXH_H
13
14#include <cstdint>
15#include <type_traits>
16
20namespace xxh3 {
21
28std::uint64_t hash64(const void* data, std::size_t size);
29
38template <typename Cont>
39std::uint64_t hash64(const Cont& cont) {
40 return hash64(cont.data(), cont.size() * sizeof(typename Cont::value_type));
41}
42
49template <typename POD,
50 typename = std::enable_if_t<std::is_standard_layout_v<POD> &&
51 std::is_trivial_v<POD>>>
52std::uint64_t hash64(const POD& pod) {
53 return hash64(&pod, sizeof(POD));
54}
55} // namespace xxh3
56
57#endif // CXXUTILS_XXH_H
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Wrapper namespace for our xxhash (xxh3) wrapper function.
Definition XXH.h:20
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition XXH.cxx:9