ATLAS Offline Software
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 
20 namespace xxh3 {
21 
28 std::uint64_t hash64(const void* data, std::size_t size);
29 
38 template <typename Cont>
39 std::uint64_t hash64(const Cont& cont) {
40  return hash64(cont.data(), cont.size() * sizeof(typename Cont::value_type));
41 }
42 
49 template <typename POD,
50  typename = std::enable_if_t<std::is_standard_layout_v<POD> &&
51  std::is_trivial_v<POD>>>
52 std::uint64_t hash64(const POD& pod) {
53  return hash64(&pod, sizeof(POD));
54 }
55 } // namespace xxh3
56 
57 #endif // CXXUTILS_XXH_H
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
xxh3
Wrapper namespace for our xxhash (xxh3) wrapper function.
Definition: XXH.h:20
xxh3::hash64
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition: XXH.cxx:9