[bitboard] Implement BitBoard::is_single_square()
Returns true if there's only one square set in the bitboard.
This commit is contained in:
		
							parent
							
								
									0f664f6c80
								
							
						
					
					
						commit
						cb48413ce7
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -78,6 +78,10 @@ impl BitBoard {
 | 
				
			||||||
        let sq_bb: BitBoard = sq.into();
 | 
					        let sq_bb: BitBoard = sq.into();
 | 
				
			||||||
        *self &= !sq_bb
 | 
					        *self &= !sq_bb
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pub fn is_single_square(&self) -> bool {
 | 
				
			||||||
 | 
					        self.0.is_power_of_two()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl BitBoard {
 | 
					impl BitBoard {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue