From 0fc9a01933ce33fda3732c1d5bbde5a8908d0019 Mon Sep 17 00:00:00 2001 From: jundery Date: Wed, 27 Feb 2013 22:18:11 -0700 Subject: [PATCH] Remove strange use of the ternary operator Note that we read shared data without lock protection, so code is theoretically prone to torn reads. But, first splitPoint pointer never changes, and alpha is of integer type so it is read in a single DWORD access. No functional change. --- src/search.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index b235a1e6..1214cbdc 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -927,7 +927,8 @@ split_point_start: // At split points actual search starts from here { ss->reduction = reduction(depth, moveCount); Depth d = std::max(newDepth - ss->reduction, ONE_PLY); - alpha = SpNode ? sp->alpha : alpha; + if (SpNode) + alpha = sp->alpha; value = -search(pos, ss+1, -(alpha+1), -alpha, d); @@ -940,7 +941,9 @@ split_point_start: // At split points actual search starts from here // Step 16. Full depth search, when LMR is skipped or fails high if (doFullDepthSearch) { - alpha = SpNode ? sp->alpha : alpha; + if (SpNode) + alpha = sp->alpha; + value = newDepth < ONE_PLY ? givesCheck ? -qsearch(pos, ss+1, -(alpha+1), -alpha, DEPTH_ZERO) : -qsearch(pos, ss+1, -(alpha+1), -alpha, DEPTH_ZERO) -- 2.39.2