move_t flags: mask -> value, unique castling flag (1 bit saved)

This commit is contained in:
2024-06-25 15:33:56 +02:00
parent 5cb90f5396
commit ffd5d056cc
3 changed files with 24 additions and 33 deletions

View File

@@ -379,13 +379,13 @@ movelist_t *pos_gen_pseudo(pos_t *pos, movelist_t *movelist)
/* CHANGE HERE, either with bitmask >> or direct sq check */
bitboard_t occmask = rel_rank1 & (FILE_Fbb | FILE_Gbb);
if (!(occ & occmask)) {
*moves++ = move_make_flags(king, king + 2, M_CASTLE_K);
*moves++ = move_make_flags(king, king + 2, M_CASTLE);
}
}
if (can_ooo(pos->castle, us)) {
bitboard_t occmask = rel_rank1 & (FILE_Bbb | FILE_Cbb | FILE_Dbb);
if (!(occ & occmask)) { // &&
*moves++ = move_make_flags(king, king - 2, M_CASTLE_Q);
*moves++ = move_make_flags(king, king - 2, M_CASTLE);
}
}
}