diff options
Diffstat (limited to 'src/board')
-rw-r--r-- | src/board/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs index 2bb1147..a1166d6 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -255,7 +255,7 @@ impl Board { } pub fn generate_pseudolegal_moves(&self, color: Color) -> Vec<Move> { - let mut moves = Vec::with_capacity(1024); + let mut moves = Vec::with_capacity(256); let capture_targets = self.color_occupancy(color.flip()) ^ match color { // Exclude opponent king because we can't capture it Color::White => self.pieces[PieceType::KingBlack as usize], @@ -555,10 +555,11 @@ impl Board { } fn piece_by_square(&self, square: Square) -> Option<PieceType> { + let square_bb = square.to_bitboard(); self.pieces .iter() .enumerate() - .find(|(_, bitboard)| *bitboard & square.to_bitboard() > 0) + .find(|(_, bitboard)| *bitboard & square_bb > 0) .and_then(|(pt, _)| Some(PieceType::from(pt))) } |