25 table_(1ull << bits), seal_(1)
35inline std::size_t cache::index(
const hash_t &h)
const
37 return h.data[0] & k_mask;
47 std::unique_lock lock(mutex_);
65 std::unique_lock lock(mutex_);
67 table_[index(h)].hash =
hash_t();
83 std::shared_lock lock(mutex_);
85 const slot &s(table_[index(h)]);
86 const bool ret(seal_ == s.seal && h == s.hash);
104 std::unique_lock lock(mutex_);
111 table_[index(s.hash)] = s;
123 std::unique_lock lock(mutex_);
125 decltype(seal_) t_seal;
133 for (
decltype(n) i(0); i < n; ++i)
138 if (!s.hash.load(in))
140 if (!s.fitness.load(in))
143 table_[index(s.hash)] = s;
157 std::shared_lock lock(mutex_);
159 out << seal_ <<
' ' <<
'\n';
162 for (
const auto &s : table_)
167 for (
const auto &s : table_)
168 if (s.seal == seal_ && !s.hash.empty())
cache(unsigned)
Creates a new hash table.
void clear()
Clears the content and the statistical informations of the table.
const fitness_t & find(const hash_t &) const
Looks for the fitness of an individual in the transposition table.
void insert(const hash_t &, const fitness_t &)
Stores fitness information in the transposition table.
bool save(std::ostream &) const
bool load(std::istream &)
Contains flags and manipulators to control the output format of individuals.
The main namespace for the project.
A 128bit unsigned integer used as individual's signature / hash table look-up key.