mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 02:27:00 +08:00
Better name and document magic botboard stuff
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -69,7 +69,7 @@ extern uint8_t BitCount8Bit[256];
|
||||
struct Magics {
|
||||
Bitboard mask;
|
||||
uint64_t mult;
|
||||
uint32_t index;
|
||||
uint32_t offset;
|
||||
uint32_t shift;
|
||||
};
|
||||
|
||||
@@ -189,14 +189,14 @@ inline Bitboard bishop_attacks_bb(Square s, Bitboard occ) {
|
||||
inline Bitboard rook_attacks_bb(Square s, Bitboard occ) {
|
||||
const Magics& m = RMagics[s];
|
||||
Bitboard b = occ & m.mask;
|
||||
return RAttacks[m.index +
|
||||
return RAttacks[m.offset +
|
||||
((unsigned(b) * unsigned(m.mult) ^ unsigned(b >> 32) * unsigned(m.mult >> 32)) >> m.shift)];
|
||||
}
|
||||
|
||||
inline Bitboard bishop_attacks_bb(Square s, Bitboard occ) {
|
||||
const Magics& m = BMagics[s];
|
||||
Bitboard b = occ & m.mask;
|
||||
return BAttacks[m.index +
|
||||
return BAttacks[m.offset +
|
||||
((unsigned(b) * unsigned(m.mult) ^ unsigned(b >> 32) * unsigned(m.mult >> 32)) >> m.shift)];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user