Introduce single_bit() helper

Self-documenting code instead of a tricky
bitwise tweak, not known by everybody.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-03-04 23:26:08 +01:00
parent cf0561d31a
commit 19540c9ee8
4 changed files with 11 additions and 4 deletions

View File

@@ -1351,7 +1351,7 @@ split_point_start: // At split points actual search starts from here
// Rule 1. Checks which give opponent's king at most one escape square are dangerous
b = kingAtt & ~pos.pieces(them) & ~newAtt & ~(1ULL << to);
if (!(b && (b & (b - 1))))
if (single_bit(b)) // Catches also !b
return true;
// Rule 2. Queen contact check is very dangerous