- InFrontBB[WHITE][rw] = InFrontBB[WHITE][rw + 1] | RankBB[rw + 1];
- InFrontBB[BLACK][rb] = InFrontBB[BLACK][rb - 1] | RankBB[rb - 1];
- }
-
- for (Color c = WHITE; c <= BLACK; c++)
- for (Square s = SQ_A1; s <= SQ_H8; s++)
- {
- SquaresInFrontMask[c][s] = in_front_bb(c, s) & file_bb(s);
- PassedPawnMask[c][s] = in_front_bb(c, s) & this_and_neighboring_files_bb(s);
- AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
- }
-
- for (Bitboard b = 0; b < 256; b++)
- BitCount8Bit[b] = (uint8_t)count_1s<CNT32>(b);
-
- for (int i = 1; i < 64; i++)
- if (!CpuIs64Bit) // Matt Taylor's folding trick for 32 bit systems
- {
- Bitboard b = 1ULL << i;
- b ^= b - 1;
- b ^= b >> 32;
- BSFTable[uint32_t(b * 0x783A9B23) >> 26] = i;
- }
- else
- BSFTable[((1ULL << i) * 0x218A392CD3D5DBFULL) >> 58] = i;
-
- int steps[][9] = {
- {0}, {7,9,0}, {17,15,10,6,-6,-10,-15,-17,0}, {0}, {0}, {0}, {9,7,-7,-9,8,1,-1,-8,0}
- };
-
- for (Color c = WHITE; c <= BLACK; c++)
- for (Square s = SQ_A1; s <= SQ_H8; s++)
- for (PieceType pt = PAWN; pt <= KING; pt++)
- for (int k = 0; steps[pt][k]; k++)
- {
- Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);