1use crate::types::{CastlingRights, CastlingSide, Cell, Color, Coord};
2
3include!(concat!(env!("OUT_DIR"), "/zobrist.rs"));
4
5#[inline]
6pub fn pieces(cell: Cell, coord: Coord) -> u64 {
7 unsafe {
8 *PIECES
9 .get_unchecked(cell.index())
10 .get_unchecked(coord.index())
11 }
12}
13
14#[inline]
15pub fn enpassant(coord: Coord) -> u64 {
16 unsafe { *ENPASSANT.get_unchecked(coord.index()) }
17}
18
19#[inline]
20pub fn castling(rights: CastlingRights) -> u64 {
21 unsafe { *CASTLING.get_unchecked(rights.index()) }
22}
23
24#[inline]
25pub fn castling_delta(color: Color, side: CastlingSide) -> u64 {
26 match side {
27 CastlingSide::Queen => unsafe { *CASTLING_QUEENSIDE.get_unchecked(color as u8 as usize) },
28 CastlingSide::King => unsafe { *CASTLING_KINGSIDE.get_unchecked(color as u8 as usize) },
29 }
30}