1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Normalize some variable names and reuse existing logic

closes https://github.com/official-stockfish/Stockfish/pull/5346

No functional change
This commit is contained in:
Disservin 2024-06-03 19:47:34 +02:00
parent 86b564055d
commit ba06671aa9
3 changed files with 6 additions and 8 deletions

View file

@ -137,10 +137,10 @@ void update_all_stats(const Position& pos,
Search::Worker::Worker(SharedState& sharedState, Search::Worker::Worker(SharedState& sharedState,
std::unique_ptr<ISearchManager> sm, std::unique_ptr<ISearchManager> sm,
size_t thread_id, size_t threadId,
NumaReplicatedAccessToken token) : NumaReplicatedAccessToken token) :
// Unpack the SharedState struct into member variables // Unpack the SharedState struct into member variables
thread_idx(thread_id), threadIdx(threadId),
numaAccessToken(token), numaAccessToken(token),
manager(std::move(sm)), manager(std::move(sm)),
options(sharedState.options), options(sharedState.options),

View file

@ -244,7 +244,7 @@ class Worker {
// It searches from the root position and outputs the "bestmove". // It searches from the root position and outputs the "bestmove".
void start_searching(); void start_searching();
bool is_mainthread() const { return thread_idx == 0; } bool is_mainthread() const { return threadIdx == 0; }
// Public because they need to be updatable by the stats // Public because they need to be updatable by the stats
CounterMoveHistory counterMoves; CounterMoveHistory counterMoves;
@ -270,7 +270,7 @@ class Worker {
// Get a pointer to the search manager, only allowed to be called by the // Get a pointer to the search manager, only allowed to be called by the
// main thread. // main thread.
SearchManager* main_manager() const { SearchManager* main_manager() const {
assert(thread_idx == 0); assert(threadIdx == 0);
return static_cast<SearchManager*>(manager.get()); return static_cast<SearchManager*>(manager.get());
} }
@ -291,7 +291,7 @@ class Worker {
Depth rootDepth, completedDepth; Depth rootDepth, completedDepth;
Value rootDelta; Value rootDelta;
size_t thread_idx; size_t threadIdx;
NumaReplicatedAccessToken numaAccessToken; NumaReplicatedAccessToken numaAccessToken;
// Reductions lookup table initialized at startup // Reductions lookup table initialized at startup

View file

@ -127,9 +127,7 @@ void Thread::idle_loop() {
} }
} }
Search::SearchManager* ThreadPool::main_manager() { Search::SearchManager* ThreadPool::main_manager() { return main_thread()->worker->main_manager(); }
return static_cast<Search::SearchManager*>(main_thread()->worker.get()->manager.get());
}
uint64_t ThreadPool::nodes_searched() const { return accumulate(&Search::Worker::nodes); } uint64_t ThreadPool::nodes_searched() const { return accumulate(&Search::Worker::nodes); }
uint64_t ThreadPool::tb_hits() const { return accumulate(&Search::Worker::tbHits); } uint64_t ThreadPool::tb_hits() const { return accumulate(&Search::Worker::tbHits); }