mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Explicitly defaulted and deleted members
Better than a bit obscure implicit ones. No functional change.
This commit is contained in:
parent
2ca2c3f35b
commit
96e36a7897
6 changed files with 12 additions and 17 deletions
|
@ -45,11 +45,10 @@ namespace Time {
|
|||
|
||||
template<class Entry, int Size>
|
||||
struct HashTable {
|
||||
HashTable() : table(Size, Entry()) {}
|
||||
Entry* operator[](Key key) { return &table[(uint32_t)key & (Size - 1)]; }
|
||||
|
||||
private:
|
||||
std::vector<Entry> table;
|
||||
std::vector<Entry> table = std::vector<Entry>(Size);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ typedef Stats<false, std::pair<Move, Move> > MovesStats;
|
|||
/// to get a cut-off first.
|
||||
|
||||
class MovePicker {
|
||||
|
||||
MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
|
||||
|
||||
public:
|
||||
MovePicker(const MovePicker&) = delete;
|
||||
MovePicker& operator=(const MovePicker&) = delete;
|
||||
|
||||
MovePicker(const Position&, Move, Depth, const HistoryStats&, Square);
|
||||
MovePicker(const Position&, Move, const HistoryStats&, PieceType);
|
||||
MovePicker(const Position&, Move, Depth, const HistoryStats&, Move*, Move*, Search::Stack*);
|
||||
|
|
|
@ -82,12 +82,11 @@ class Position {
|
|||
|
||||
friend std::ostream& operator<<(std::ostream&, const Position&);
|
||||
|
||||
Position(const Position&); // Disable the default copy constructor
|
||||
|
||||
public:
|
||||
static void init();
|
||||
|
||||
Position() {} // To define the global object RootPos
|
||||
Position() = default; // To define the global object RootPos
|
||||
Position(const Position&) = delete;
|
||||
Position(const Position& pos, Thread* th) { *this = pos; thisThread = th; }
|
||||
Position(const std::string& f, bool c960, Thread* th) { set(f, c960, th); }
|
||||
Position& operator=(const Position&); // To assign RootPos from UCI
|
||||
|
|
11
src/thread.h
11
src/thread.h
|
@ -73,8 +73,7 @@ struct SplitPoint {
|
|||
|
||||
struct ThreadBase {
|
||||
|
||||
ThreadBase() : exit(false) {}
|
||||
virtual ~ThreadBase() {}
|
||||
virtual ~ThreadBase() = default;
|
||||
virtual void idle_loop() = 0;
|
||||
void notify_one();
|
||||
void wait_for(volatile const bool& b);
|
||||
|
@ -82,7 +81,7 @@ struct ThreadBase {
|
|||
std::thread nativeThread;
|
||||
std::mutex mutex;
|
||||
std::condition_variable sleepCondition;
|
||||
volatile bool exit;
|
||||
volatile bool exit = false;
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,19 +117,17 @@ struct Thread : public ThreadBase {
|
|||
/// special threads: the main one and the recurring timer.
|
||||
|
||||
struct MainThread : public Thread {
|
||||
MainThread() : thinking(true) {} // Avoid a race with start_thinking()
|
||||
virtual void idle_loop();
|
||||
volatile bool thinking;
|
||||
volatile bool thinking = true; // Avoid a race with start_thinking()
|
||||
};
|
||||
|
||||
struct TimerThread : public ThreadBase {
|
||||
|
||||
static const int Resolution = 5; // Millisec between two check_time() calls
|
||||
|
||||
TimerThread() : run(false) {}
|
||||
virtual void idle_loop();
|
||||
|
||||
bool run;
|
||||
bool run = false;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ TranspositionTable TT; // Our global transposition table
|
|||
|
||||
void TranspositionTable::resize(size_t mbSize) {
|
||||
|
||||
assert(sizeof(Cluster) == CacheLineSize / 2);
|
||||
|
||||
size_t newClusterCount = size_t(1) << msb((mbSize * 1024 * 1024) / sizeof(Cluster));
|
||||
|
||||
if (newClusterCount == clusterCount)
|
||||
|
|
2
src/tt.h
2
src/tt.h
|
@ -81,6 +81,8 @@ class TranspositionTable {
|
|||
char padding[2]; // Align to the cache line size
|
||||
};
|
||||
|
||||
static_assert(sizeof(Cluster) == CacheLineSize / 2, "Cluster size incorrect");
|
||||
|
||||
public:
|
||||
~TranspositionTable() { free(mem); }
|
||||
void new_search() { generation8 += 4; } // Lower 2 bits are used by Bound
|
||||
|
|
Loading…
Add table
Reference in a new issue