Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved 32 bit compilation #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions flat_hash_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,11 @@ struct fibonacci_hash_policy
{
size_t index_for_hash(size_t hash, size_t /*num_slots_minus_one*/) const
{
#ifdef ENV64BIT
return (11400714819323198485ull * hash) >> shift;
#else
return (2654435769u * hash) >> shift;
#endif
}
size_t keep_in_range(size_t index, size_t num_slots_minus_one) const
{
Expand All @@ -1326,19 +1330,19 @@ struct fibonacci_hash_policy
int8_t next_size_over(size_t & size) const
{
size = std::max(size_t(2), detailv3::next_power_of_two(size));
return 64 - detailv3::log2(size);
return sizeof(size_t) * CHAR_BIT - detailv3::log2(size);
}
void commit(int8_t shift)
{
this->shift = shift;
}
void reset()
{
shift = 63;
shift = sizeof(size_t) * CHAR_BIT - 1;
}

private:
int8_t shift = 63;
int8_t shift = sizeof(size_t) * CHAR_BIT - 1;
};

template<typename K, typename V, typename H = std::hash<K>, typename E = std::equal_to<K>, typename A = std::allocator<std::pair<K, V> > >
Expand Down