[Bug] ctti::detail::sid_hash() hash multiplier is not a prime (Ups)
Manu343726 opened this issue · 1 comments
Manu343726 commented
[Bug] ctti::detail::sid_hash() hash multiplier is not a prime (Ups)
bmmogensen commented
The fnv_prime should have been 1099511628211 instead of 109951162821. The last 1 appears to have been lost in translation. The following patch should fix it:
--- a/include/ctti/detail/hash.hpp
+++ b/include/ctti/detail/hash.hpp
@@ -12,7 +12,7 @@ namespace ctti
using hash_t = std::uint64_t;
constexpr hash_t fnv_basis = 14695981039346656037ull;
- constexpr hash_t fnv_prime = 109951162821ull;
+ constexpr hash_t fnv_prime = 1099511628211ull;
// FNV-1a 64 bit hash
constexpr hash_t sid_hash(std::size_t n, const char *str, hash_t hash = fnv_basis)