mirror of https://github.com/CGAL/cgal
WIP: Hard coded appromimated hash function
This commit is contained in:
parent
9303a3318a
commit
febb607934
|
|
@ -37,8 +37,14 @@ class Small_unordered_map{
|
||||||
mutable std::array<int, M> occupied;
|
mutable std::array<int, M> occupied;
|
||||||
std::array<int, M> unfreelist;
|
std::array<int, M> unfreelist;
|
||||||
std::array<std::pair<K,T>, M> data;
|
std::array<std::pair<K,T>, M> data;
|
||||||
const H hash = {};
|
//const H h = {};
|
||||||
|
|
||||||
|
int hash(const K& k)const
|
||||||
|
{
|
||||||
|
std::size_t hf = boost::hash<typename K::first_type>()(k.first);
|
||||||
|
std::size_t hs = boost::hash<typename K::second_type>()(k.second);
|
||||||
|
return (hf + 1) ^ (419 * (hs + 1));
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Small_unordered_map()
|
Small_unordered_map()
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::size_t hash_value(const T* p) {
|
static std::size_t hash_value(const T* p) {
|
||||||
return reinterpret_cast<std::size_t>(p)/sizeof(T);
|
|
||||||
|
return reinterpret_cast<std::size_t>(p) >> 5; // sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {}
|
void reset() {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue