[board] Return copies of rank and file bitboards from static lists
This commit is contained in:
parent
e30bcb3105
commit
1cc8b4520f
3 changed files with 31 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use super::library::{FILES, RANKS};
|
||||
use super::BitScanner;
|
||||
use crate::Square;
|
||||
use std::fmt;
|
||||
|
@ -17,14 +18,14 @@ impl BitBoard {
|
|||
BitBoard(bits)
|
||||
}
|
||||
|
||||
pub fn rank(rank: u8) -> BitBoard {
|
||||
pub fn rank(rank: usize) -> BitBoard {
|
||||
assert!(rank < 8);
|
||||
BitBoard(0xFF).shift_north(rank)
|
||||
RANKS[rank]
|
||||
}
|
||||
|
||||
pub fn file(file: u8) -> BitBoard {
|
||||
pub fn file(file: usize) -> BitBoard {
|
||||
assert!(file < 8);
|
||||
BitBoard(0x0101010101010101).shift_east(file)
|
||||
FILES[file]
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue