Statically assert zero-cost invariants
Since some or all of those invariants will come in handy to ensure we use as little memory as possible, to maximize the speed of the move generation later on.
This commit is contained in:
parent
accbbef64e
commit
a6f4e7e686
4 changed files with 17 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use super::Square;
|
||||
use crate::utils::static_assert;
|
||||
|
||||
mod iterator;
|
||||
use iterator::*;
|
||||
|
||||
|
|
@ -63,6 +65,9 @@ impl Bitboard {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure zero-cost (at least size-wise) wrapping.
|
||||
static_assert!(std::mem::size_of::<Bitboard>() == std::mem::size_of::<u64>());
|
||||
|
||||
impl Default for Bitboard {
|
||||
fn default() -> Self {
|
||||
Self::EMPTY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue