Get rid of Shift[] tables

We can calculate them counting the masks bits.

Also small tweak to sliding_attacks()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-06-05 12:09:55 +01:00
parent 3092f0c646
commit 670cee44f0
2 changed files with 18 additions and 46 deletions

View File

@@ -176,12 +176,12 @@ inline Bitboard in_front_bb(Color c, Square s) {
inline Bitboard rook_attacks_bb(Square s, Bitboard occ) {
const Magics& m = RMagics[s];
return RAttacks[m.index + (((occ & m.mask) * m.mult) >> m.shift)];
return RAttacks[m.offset + (((occ & m.mask) * m.mult) >> m.shift)];
}
inline Bitboard bishop_attacks_bb(Square s, Bitboard occ) {
const Magics& m = BMagics[s];
return BAttacks[m.index + (((occ & m.mask) * m.mult) >> m.shift)];
return BAttacks[m.offset + (((occ & m.mask) * m.mult) >> m.shift)];
}
#else // if !defined(IS_64BIT)