mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Use size_t consistently across thread code
No functional change.
This commit is contained in:
parent
8d47caa16e
commit
950c8436ed
3 changed files with 8 additions and 7 deletions
|
@ -1594,7 +1594,7 @@ void Thread::idle_loop() {
|
||||||
|
|
||||||
for (size_t i = 0; i < Threads.size(); ++i)
|
for (size_t i = 0; i < Threads.size(); ++i)
|
||||||
{
|
{
|
||||||
const int size = Threads[i]->splitPointsSize; // Local copy
|
const size_t size = Threads[i]->splitPointsSize; // Local copy
|
||||||
sp = size ? &Threads[i]->splitPoints[size - 1] : NULL;
|
sp = size ? &Threads[i]->splitPoints[size - 1] : NULL;
|
||||||
|
|
||||||
if ( sp
|
if ( sp
|
||||||
|
@ -1705,7 +1705,7 @@ void check_time() {
|
||||||
// Loop across all split points and sum accumulated SplitPoint nodes plus
|
// Loop across all split points and sum accumulated SplitPoint nodes plus
|
||||||
// all the currently active positions nodes.
|
// all the currently active positions nodes.
|
||||||
for (size_t i = 0; i < Threads.size(); ++i)
|
for (size_t i = 0; i < Threads.size(); ++i)
|
||||||
for (int j = 0; j < Threads[i]->splitPointsSize; ++j)
|
for (size_t j = 0; j < Threads[i]->splitPointsSize; ++j)
|
||||||
{
|
{
|
||||||
SplitPoint& sp = Threads[i]->splitPoints[j];
|
SplitPoint& sp = Threads[i]->splitPoints[j];
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,8 @@ void ThreadBase::wait_for(volatile const bool& condition) {
|
||||||
Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC
|
Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC
|
||||||
|
|
||||||
searching = false;
|
searching = false;
|
||||||
maxPly = splitPointsSize = 0;
|
maxPly = 0;
|
||||||
|
splitPointsSize = 0;
|
||||||
activeSplitPoint = NULL;
|
activeSplitPoint = NULL;
|
||||||
activePosition = NULL;
|
activePosition = NULL;
|
||||||
idx = Threads.size(); // Starts from 0
|
idx = Threads.size(); // Starts from 0
|
||||||
|
@ -123,7 +124,7 @@ bool Thread::available_to(const Thread* master) const {
|
||||||
|
|
||||||
// Make a local copy to be sure it doesn't become zero under our feet while
|
// Make a local copy to be sure it doesn't become zero under our feet while
|
||||||
// testing next condition and so leading to an out of bounds access.
|
// testing next condition and so leading to an out of bounds access.
|
||||||
const int size = splitPointsSize;
|
const size_t size = splitPointsSize;
|
||||||
|
|
||||||
// No split points means that the thread is available as a slave for any
|
// No split points means that the thread is available as a slave for any
|
||||||
// other thread otherwise apply the "helpful master" concept if possible.
|
// other thread otherwise apply the "helpful master" concept if possible.
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
struct Thread;
|
struct Thread;
|
||||||
|
|
||||||
const int MAX_THREADS = 128;
|
const size_t MAX_THREADS = 128;
|
||||||
const int MAX_SPLITPOINTS_PER_THREAD = 8;
|
const size_t MAX_SPLITPOINTS_PER_THREAD = 8;
|
||||||
const size_t MAX_SLAVES_PER_SPLITPOINT = 4;
|
const size_t MAX_SLAVES_PER_SPLITPOINT = 4;
|
||||||
|
|
||||||
/// Mutex and ConditionVariable struct are wrappers of the low level locking
|
/// Mutex and ConditionVariable struct are wrappers of the low level locking
|
||||||
|
@ -136,7 +136,7 @@ struct Thread : public ThreadBase {
|
||||||
size_t idx;
|
size_t idx;
|
||||||
int maxPly;
|
int maxPly;
|
||||||
SplitPoint* volatile activeSplitPoint;
|
SplitPoint* volatile activeSplitPoint;
|
||||||
volatile int splitPointsSize;
|
volatile size_t splitPointsSize;
|
||||||
volatile bool searching;
|
volatile bool searching;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue