Commit 721cf711 authored by Dominik Charousset's avatar Dominik Charousset

Fix unused-const-variable warning

parent b52c9432
......@@ -18,41 +18,42 @@
#include "caf/detail/fnv_hash.hpp"
#include <cstdint>
namespace caf {
namespace detail {
namespace {
template <size_t IntegerSize>
struct hash_conf_helper;
#if SIZE_MAX == 0xFFFFFFFF
constexpr size_t basis = 2166136261u;
constexpr size_t prime = 16777619u;
#elif SIZE_MAX == 0xFFFFFFFFFFFFFFFF
template <>
struct hash_conf_helper<4> {
static constexpr size_t basis = 2166136261u;
constexpr size_t basis = 14695981039346656037u;
static constexpr size_t prime = 16777619u;
};
constexpr size_t prime = 1099511628211u;
template <>
struct hash_conf_helper<8> {
static constexpr size_t basis = 14695981039346656037u;
#else
static constexpr size_t prime = 1099511628211u;
};
# error Platform and/or compiler not supported
struct hash_conf : hash_conf_helper<sizeof(size_t)> {};
#endif
} // namespace
size_t fnv_hash(const unsigned char* first, const unsigned char* last) {
return fnv_hash_append(hash_conf::basis, first, last);
return fnv_hash_append(basis, first, last);
}
size_t fnv_hash_append(size_t intermediate, const unsigned char* first,
const unsigned char* last) {
auto result = intermediate;
for (; first != last; ++first) {
result *= hash_conf::prime;
result *= prime;
result ^= *first;
}
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment