- {
- SquareBB[s] = 1ULL << s;
- BSFTable[bsf_index(SquareBB[s])] = s;
- }
-
- for (Bitboard b = 2; b < 256; ++b)
- MSBTable[b] = MSBTable[b - 1] + !more_than_one(b);
-
- for (File f = FILE_A; f <= FILE_H; ++f)
- FileBB[f] = f > FILE_A ? FileBB[f - 1] << 1 : FileABB;
-
- for (Rank r = RANK_1; r <= RANK_8; ++r)
- RankBB[r] = r > RANK_1 ? RankBB[r - 1] << 8 : Rank1BB;
-
- for (File f = FILE_A; f <= FILE_H; ++f)
- AdjacentFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0);
-
- for (Rank r = RANK_1; r < RANK_8; ++r)
- InFrontBB[WHITE][r] = ~(InFrontBB[BLACK][r + 1] = InFrontBB[BLACK][r] | RankBB[r]);
-
- for (Color c = WHITE; c <= BLACK; ++c)
- for (Square s = SQ_A1; s <= SQ_H8; ++s)
- {
- ForwardBB[c][s] = InFrontBB[c][rank_of(s)] & FileBB[file_of(s)];
- PawnAttackSpan[c][s] = InFrontBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)];
- PassedPawnMask[c][s] = ForwardBB[c][s] | PawnAttackSpan[c][s];
- }