-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
transpositiontable.h
executable file
·43 lines (36 loc) · 1.07 KB
/
transpositiontable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef TRANSPOSITIONTABLE_H
#define TRANSPOSITIONTABLE_H
#include "defines.h"
#include "hashentry.h"
#include "spinlock.h"
#include <mutex>
#include <atomic>
namespace Napoleon
{
class TranspositionTable
{
public:
static const int Unknown;
static const int BucketSize;
TranspositionTable() = default;
TranspositionTable(int size);
void SetSize(int);
void Save(ZobristKey, Byte, Byte, int, Move, ScoreType);
void Clear();
std::pair<int, Move> Probe(ZobristKey, Byte, Byte, int, int);
Move GetPv(ZobristKey);
bool Concurrent = false;
private:
unsigned long long mask;
unsigned long entries;
unsigned long lock_entries;
HashEntry* table;
SpinLock* locks;
HashEntry* at(ZobristKey, int = 0) const;
};
inline HashEntry* TranspositionTable::at(ZobristKey key, int index) const
{
return table + (key & mask) + index;
}
}
#endif // TRANSPOSITIONTABLE_H