Revert to byTypeBB[0] storing occupied squares

As it was in Glaurung times. Also rearranged order
so that byTypeBB[0] is accessed before byTypeBB[x]
to be more cache friendly. It seems there is even
a small speedup.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-03-18 11:33:54 +01:00
parent fc3ea7365a
commit 7bc3688714
3 changed files with 22 additions and 23 deletions
+4 -5
View File
@@ -231,7 +231,6 @@ private:
// Bitboards
Bitboard byTypeBB[8]; // [pieceType]
Bitboard byColorBB[2]; // [color]
Bitboard occupied;
// Piece counts
int pieceCount[2][8]; // [color][pieceType]
@@ -286,7 +285,7 @@ inline Color Position::side_to_move() const {
}
inline Bitboard Position::pieces() const {
return occupied;
return byTypeBB[ALL_PIECES];
}
inline Bitboard Position::pieces(Color c) const {
@@ -334,7 +333,7 @@ inline bool Position::can_castle(Color c) const {
}
inline bool Position::castle_impeded(CastleRight f) const {
return occupied & castlePath[f];
return byTypeBB[ALL_PIECES] & castlePath[f];
}
inline Square Position::castle_rook_square(CastleRight f) const {
@@ -354,11 +353,11 @@ inline Bitboard Position::attacks_from<PAWN>(Square s, Color c) const {
}
inline Bitboard Position::attacks_from(Piece p, Square s) const {
return attacks_from(p, s, occupied);
return attacks_from(p, s, byTypeBB[ALL_PIECES]);
}
inline Bitboard Position::attackers_to(Square s) const {
return attackers_to(s, occupied);
return attackers_to(s, byTypeBB[ALL_PIECES]);
}
inline Bitboard Position::checkers() const {