X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=9704839408e8ad7d9698222ecb2b664d0235cc53;hp=d846765b26b69d776ed189abc0744e4f51067662;hb=927f1b0bd30a5b2cfdcdf163f26f528738509064;hpb=59c85346d28f96ae69e172ff7187ccfbbf78d180 diff --git a/src/bitboard.h b/src/bitboard.h index d846765b..97048394 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -21,8 +21,6 @@ #if !defined(BITBOARD_H_INCLUDED) #define BITBOARD_H_INCLUDED -#include "piece.h" -#include "square.h" #include "types.h" const Bitboard EmptyBoardBB = 0; @@ -45,17 +43,17 @@ const Bitboard Rank6BB = Rank1BB << (8 * 5); const Bitboard Rank7BB = Rank1BB << (8 * 6); const Bitboard Rank8BB = Rank1BB << (8 * 7); -extern const Bitboard SquaresByColorBB[2]; -extern const Bitboard FileBB[8]; -extern const Bitboard NeighboringFilesBB[8]; -extern const Bitboard ThisAndNeighboringFilesBB[8]; -extern const Bitboard RankBB[8]; -extern const Bitboard InFrontBB[2][8]; +extern Bitboard SquaresByColorBB[2]; +extern Bitboard FileBB[8]; +extern Bitboard NeighboringFilesBB[8]; +extern Bitboard ThisAndNeighboringFilesBB[8]; +extern Bitboard RankBB[8]; +extern Bitboard InFrontBB[2][8]; extern Bitboard SetMaskBB[65]; extern Bitboard ClearMaskBB[65]; -extern Bitboard NonSlidingAttacksBB[16][64]; +extern Bitboard StepAttacksBB[16][64]; extern Bitboard BetweenBB[64][64]; extern Bitboard SquaresInFrontMask[2][64]; @@ -259,15 +257,25 @@ inline bool squares_aligned(Square s1, Square s2, Square s3) { /// pop_1st_bit() finds and clears the least significant nonzero bit in a /// nonzero bitboard. -#if defined(USE_BSFQ) // Assembly code by Heinz van Saanen +#if defined(USE_BSFQ) -inline Square first_1(Bitboard b) { +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) + +FORCE_INLINE Square first_1(Bitboard b) { + unsigned long index; + _BitScanForward64(&index, b); + return (Square) index; +} +#else + +FORCE_INLINE Square first_1(Bitboard b) { // Assembly code by Heinz van Saanen Bitboard dummy; __asm__("bsfq %1, %0": "=r"(dummy): "rm"(b) ); - return (Square)(dummy); + return (Square) dummy; } +#endif -inline Square pop_1st_bit(Bitboard* b) { +FORCE_INLINE Square pop_1st_bit(Bitboard* b) { const Square s = first_1(*b); *b &= ~(1ULL<