X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=888e96905469b1c907340a79beaca613d2b90c41;hp=140867fa94a466272d55be020451b0eb8b012f77;hb=eced15fe36a16c38659f586bc558b1175114cc76;hpb=2bfe61c33b99bd5ebb2e4616a6e8ac5790ff4c4f diff --git a/src/bitboard.h b/src/bitboard.h index 140867fa..888e9690 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -23,8 +23,6 @@ #include "types.h" -extern Bitboard pext(Bitboard b, Bitboard mask); - namespace Bitboards { void init(); @@ -132,10 +130,9 @@ inline int rank_distance(Square s1, Square s2) { template inline Bitboard shift_bb(Bitboard b) { - return Delta == DELTA_N ? b << 8 : Delta == DELTA_S ? b >> 8 - : Delta == DELTA_NE ? (b & ~FileHBB) << 9 : Delta == DELTA_SE ? (b & ~FileHBB) >> 7 + return Delta == DELTA_NE ? (b & ~FileHBB) << 9 : Delta == DELTA_SE ? (b & ~FileHBB) >> 7 : Delta == DELTA_NW ? (b & ~FileABB) << 7 : Delta == DELTA_SW ? (b & ~FileABB) >> 9 - : 0; + : Delta > 0 ? b << Delta : b >> -Delta; } @@ -243,6 +240,9 @@ FORCE_INLINE unsigned magic_index(Square s, Bitboard occ) { Bitboard* const Magics = Pt == ROOK ? RMagics : BMagics; unsigned* const Shifts = Pt == ROOK ? RShifts : BShifts; + if (HasPext) + return unsigned(_pext_u64(occ, Masks[s])); + if (Is64Bit) return unsigned(((occ & Masks[s]) * Magics[s]) >> Shifts[s]);