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

@@ -517,7 +517,7 @@ namespace {
assert(b);
if (!(b & (b - 1)) && (b & pos.pieces(Them)))
if (single_bit(b) && (b & pos.pieces(Them)))
score += ThreatBonus[Piece][type_of(pos.piece_on(first_1(b)))] / 2;
}