diff --git a/include/contractor/graph_contractor.hpp b/include/contractor/graph_contractor.hpp index 65b31039f..541d9e74b 100644 --- a/include/contractor/graph_contractor.hpp +++ b/include/contractor/graph_contractor.hpp @@ -1096,7 +1096,7 @@ class GraphContractor // self-loops are added. std::vector node_weights; std::vector is_core_node; - util::XORFastHash fast_hash; + util::XORFastHash<> fast_hash; }; } } diff --git a/include/util/xor_fast_hash.hpp b/include/util/xor_fast_hash.hpp index b9ed0520e..6ad79d66a 100644 --- a/include/util/xor_fast_hash.hpp +++ b/include/util/xor_fast_hash.hpp @@ -35,10 +35,12 @@ namespace util 10: ret */ -class XORFastHash -{ // 65k entries - std::array table1; - std::array table2; +template class XORFastHash +{ + static_assert(MaxNumElements <= (1u << 16u), "only 65536 elements indexable with uint16_t"); + + std::array table1; + std::array table2; public: XORFastHash() diff --git a/include/util/xor_fast_hash_storage.hpp b/include/util/xor_fast_hash_storage.hpp index 6872da900..297aabb2f 100644 --- a/include/util/xor_fast_hash_storage.hpp +++ b/include/util/xor_fast_hash_storage.hpp @@ -78,7 +78,7 @@ template class XORFastHashStorage private: std::vector positions; - XORFastHash fast_hasher; + XORFastHash<> fast_hasher; unsigned current_timestamp; }; }