Power-of-two-sized direct-mapped cache for negamax search results. More...
#include <TranspositionTable.h>
Classes | |
| struct | Entry |
| One transposition-table slot. More... | |
Public Member Functions | |
| TranspositionTable (const int log_2_size=LOG_2_SIZE) | |
Allocate a transposition table with 2^log_2_size entries. | |
| Entry * | get (const Board &b) |
Get the slot associated with b. | |
Static Public Attributes | |
| static constexpr int | LOG_2_SIZE = 20 |
| Default log2 of the number of entries. | |
Power-of-two-sized direct-mapped cache for negamax search results.
The table is indexed by Board::hash() & (size - 1), which compiles down to a single masking operation. A single slot is reserved per index; collisions are simply overwritten. Each slot stores the Board's Board::uid() so that callers can recognise hash collisions.
Definition at line 26 of file TranspositionTable.h.
|
inline |
Allocate a transposition table with 2^log_2_size entries.
| log_2_size | Log-2 of the number of slots. Use 0 to obtain a single-slot table. |
Definition at line 64 of file TranspositionTable.h.
Get the slot associated with b.
The slot is shared with every position that hashes to the same index; callers must inspect Entry::b to verify a hit.
| b | Position to look up. |
TranspositionTable. Definition at line 79 of file TranspositionTable.h.
|
staticconstexpr |
Default log2 of the number of entries.
Definition at line 33 of file TranspositionTable.h.