From dc4655e1f9b77910afc6521c1b87661389b44e06 Mon Sep 17 00:00:00 2001 From: Mira Date: Sun, 6 Nov 2016 15:20:23 +0100 Subject: [PATCH] Stack offset changed from -5 to -4 Non functional change, tests under sanitizers OK. Rationales for change - Offset in code is in range -4 ... 2 - There was an error by (pathological) corner case MAX_PLY=0 No functional change. --- src/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 38399650..7f933a46 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -335,12 +335,12 @@ void MainThread::search() { void Thread::search() { - Stack stack[MAX_PLY+7], *ss = stack+5; // To allow referencing (ss-5) and (ss+2) + Stack stack[MAX_PLY+7], *ss = stack+4; // To allow referencing (ss-4) and (ss+2) Value bestValue, alpha, beta, delta; Move easyMove = MOVE_NONE; MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); - std::memset(ss-5, 0, 8 * sizeof(Stack)); + std::memset(ss-4, 0, 7 * sizeof(Stack)); bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; -- 2.39.2