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

Beta is never changed after an sp_search()

So we can use a const value instead of a pointer in
split().

Also pass NULL instead of a faked address of alpha in
case split is called from a non-PV node.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-02-21 15:28:27 +01:00
parent d38f4f61e7
commit b9537edbb0

View file

@ -84,7 +84,7 @@ namespace {
void wake_sleeping_threads(); void wake_sleeping_threads();
void put_threads_to_sleep(); void put_threads_to_sleep();
void idle_loop(int threadID, SplitPoint* waitSp); void idle_loop(int threadID, SplitPoint* waitSp);
bool split(const Position& pos, SearchStack* ss, int ply, Value* alpha, Value* beta, Value* bestValue, bool split(const Position& pos, SearchStack* ss, int ply, Value* alpha, const Value beta, Value* bestValue,
const Value futilityValue, Depth depth, int* moves, MovePicker* mp, int master, bool pvNode); const Value futilityValue, Depth depth, int* moves, MovePicker* mp, int master, bool pvNode);
private: private:
@ -1210,7 +1210,7 @@ namespace {
&& TM.available_thread_exists(threadID) && TM.available_thread_exists(threadID)
&& !AbortSearch && !AbortSearch
&& !TM.thread_should_stop(threadID) && !TM.thread_should_stop(threadID)
&& TM.split(pos, ss, ply, &alpha, &beta, &bestValue, VALUE_NONE, && TM.split(pos, ss, ply, &alpha, beta, &bestValue, VALUE_NONE,
depth, &moveCount, &mp, threadID, true)) depth, &moveCount, &mp, threadID, true))
break; break;
} }
@ -1524,7 +1524,7 @@ namespace {
&& TM.available_thread_exists(threadID) && TM.available_thread_exists(threadID)
&& !AbortSearch && !AbortSearch
&& !TM.thread_should_stop(threadID) && !TM.thread_should_stop(threadID)
&& TM.split(pos, ss, ply, &beta, &beta, &bestValue, futilityValue, //FIXME: SMP & futilityValue && TM.split(pos, ss, ply, NULL, beta, &bestValue, futilityValue, //FIXME: SMP & futilityValue
depth, &moveCount, &mp, threadID, false)) depth, &moveCount, &mp, threadID, false))
break; break;
} }
@ -2815,7 +2815,7 @@ namespace {
// splitPoint->cpus becomes 0), split() returns true. // splitPoint->cpus becomes 0), split() returns true.
bool ThreadsManager::split(const Position& p, SearchStack* sstck, int ply, bool ThreadsManager::split(const Position& p, SearchStack* sstck, int ply,
Value* alpha, Value* beta, Value* bestValue, const Value futilityValue, Value* alpha, const Value beta, Value* bestValue, const Value futilityValue,
Depth depth, int* moves, MovePicker* mp, int master, bool pvNode) { Depth depth, int* moves, MovePicker* mp, int master, bool pvNode) {
assert(p.is_ok()); assert(p.is_ok());
@ -2849,8 +2849,8 @@ namespace {
splitPoint->stopRequest = false; splitPoint->stopRequest = false;
splitPoint->ply = ply; splitPoint->ply = ply;
splitPoint->depth = depth; splitPoint->depth = depth;
splitPoint->alpha = pvNode ? *alpha : (*beta - 1); splitPoint->alpha = pvNode ? *alpha : beta - 1;
splitPoint->beta = *beta; splitPoint->beta = beta;
splitPoint->pvNode = pvNode; splitPoint->pvNode = pvNode;
splitPoint->bestValue = *bestValue; splitPoint->bestValue = *bestValue;
splitPoint->futilityValue = futilityValue; splitPoint->futilityValue = futilityValue;
@ -2911,7 +2911,6 @@ namespace {
if (pvNode) if (pvNode)
*alpha = splitPoint->alpha; *alpha = splitPoint->alpha;
*beta = splitPoint->beta;
*bestValue = splitPoint->bestValue; *bestValue = splitPoint->bestValue;
threads[master].activeSplitPoints--; threads[master].activeSplitPoints--;
threads[master].splitPoint = splitPoint->parent; threads[master].splitPoint = splitPoint->parent;