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
+1 -2
View File
@@ -379,8 +379,7 @@ Bitboard Position::hidden_checkers() const {
{
b = squares_between(ksq, pop_1st_bit(&pinners)) & occupied_squares();
// Only one bit set and is an our piece?
if (b && !(b & (b - 1)) && (b & pieces(sideToMove)))
if (b && single_bit(b) && (b & pieces(sideToMove)))
result |= b;
}
return result;