Summary
An explicit continuation comment was added to the move generation phase to indicate the intentional fallback to the STOP case, avoiding confusion and clearly warning the compiler.
(cd "$(git rev-parse --show-toplevel)" && git apply --3way <<'EOF'
diff --git a/src/movepick.cpp b/src/movepick.cpp
index 89577ee4a58738cacca2b8aa3f023eef0c801273..ddda58599983d87d0b29d9d306a8c2213cbec7a8 100644
--- a/src/movepick.cpp
+++ b/src/movepick.cpp
@@ -236,50 +236,51 @@ void MovePicker::generate_next() {
case QUIETS_2_S1:
cur = end;
end = endQuiets;
if (depth >= 3 * ONE_PLY)
sort(cur, end);
return;
case BAD_CAPTURES_S1:
// Just pick them in reverse order to get MVV/LVA ordering
cur = moves + MAX_MOVES - 1;
end = endBadCaptures;
return;
case EVASIONS_S2:
end = generate(pos, moves);
score_evasions();
return;
case QUIET_CHECKS_S3:
end = generate(pos, moves);
return;
case EVASION: case QSEARCH_0: case QSEARCH_1: case PROBCUT: case RECAPTURE:
phase = STOP;
/* fall through */
case STOP:
end = cur + 1; // Avoid another next_phase() call
return; default:
assert(false);
}
} /// MovePicker::next_move() is the most important method of the MovePicker class.
/// It returns a new pseudo legal move every time it is called, until there
/// are no more moves left. It picks the move with the biggest score from a list
/// of generated moves taking care not to return the tt move if has already been
/// searched previously.
template<>
Move MovePicker::next_move() { Move move; while (true)
{
while (cur == end)
generate_next();
EOF
)
Use RAII to free advapi32 when explicitly loaded
124. HMODULE hAdvapi32 = GetModuleHandle(TEXT("advapi32.dll"));
change for:
struct Advapi32Guard {
HMODULE hModule{};
bool loaded{};
Advapi32Guard() {
hModule = GetModuleHandle(TEXT("advapi32.dll"));
if (!hModule) {
hModule = LoadLibrary(TEXT("advapi32.dll"));
loaded = (hModule != nullptr);
}
}
~Advapi32Guard() {
if (loaded && hModule)
FreeLibrary(hModule);
}
} advapi32;
if (!advapi32.hModule)
return nullptr;
auto OpenProcessToken_f =
OpenProcessToken_t((void (*)()) GetProcAddress(advapi32.hModule, "OpenProcessToken"));
if (!OpenProcessToken_f)
return nullptr;
auto LookupPrivilegeValueA_f =
LookupPrivilegeValueA_t((void (*)()) GetProcAddress(advapi32.hModule, "LookupPrivilegeValueA"));
if (!LookupPrivilegeValueA_f)
return nullptr;
auto AdjustTokenPrivileges_f =
AdjustTokenPrivileges_t((void (*)()) GetProcAddress(advapi32.hModule, "AdjustTokenPrivileges"));
if (!AdjustTokenPrivileges_f)
return nullptr;