From 03489be59ffb3078503a253205c8054bfde74a04 Mon Sep 17 00:00:00 2001 From: dehnert Date: Mon, 13 Nov 2017 20:19:28 +0100 Subject: [PATCH] sligh FNV1a hash improvement --- src/storm/storage/BitVector.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/storm/storage/BitVector.cpp b/src/storm/storage/BitVector.cpp index 97b1945e6..60fdf166b 100644 --- a/src/storm/storage/BitVector.cpp +++ b/src/storm/storage/BitVector.cpp @@ -1001,13 +1001,15 @@ namespace storm { std::size_t FNV1aBitVectorHash::operator()(storm::storage::BitVector const& bv) const { std::size_t seed = 14695981039346656037ull; - uint64_t prime = 1099511628211ull; unsigned char const* it = reinterpret_cast(bv.buckets); unsigned char const* ite = it + 8 * bv.bucketCount(); - for (; it != ite; ++it) { - seed = (*it ^ seed) * prime; + while (it < ite) { + seed ^= *it++; + + // Multiplication with magic prime. + seed += (seed << 1) + (seed << 4) + (seed << 5) + (seed << 7) + (seed << 8) + (seed << 40); } return seed;