Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shambase
include
shambase
checksum.hpp
Go to the documentation of this file.
1
// -------------------------------------------------------//
2
//
3
// SHAMROCK code for hydrodynamics
4
// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5
// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6
// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7
//
8
// -------------------------------------------------------//
9
10
#pragma once
11
18
19
#include "
shambase/aliases_int.hpp
"
20
#include <cstddef>
21
22
namespace
shambase
{
23
31
inline
u64
fnv1a_hash
(
const
char
*data,
size_t
size) {
32
constexpr
u64
fnv_offset_basis = 14695981039346656037ULL;
33
constexpr
u64
fnv_prime = 1099511628211ULL;
34
35
u64
hash = fnv_offset_basis;
36
for
(
size_t
i = 0; i < size; ++i) {
37
hash ^=
static_cast<
u64
>
(
static_cast<
unsigned
char
>
(data[i]));
38
hash *= fnv_prime;
39
}
40
return
hash;
41
}
42
43
}
// namespace shambase
aliases_int.hpp
u64
std::uint64_t u64
64 bit unsigned integer
Definition
aliases_int.hpp:26
shambase
namespace for basic c++ utilities
Definition
sycl_builtins.hpp:25
shambase::fnv1a_hash
u64 fnv1a_hash(const char *data, size_t size)
Compute the FNV-1a hash of a given data.
Definition
checksum.hpp:31
Generated on
for Shamrock by
1.15.0