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
d51d72377e
commit
585c127381
4 changed files with 17 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use super::Bitboard;
|
||||
use crate::utils::static_assert;
|
||||
|
||||
/// An enum representing a singular file on a chess board (i.e: the columns).
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
|
@ -74,6 +75,9 @@ impl File {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure that niche-optimization is in effect.
|
||||
static_assert!(std::mem::size_of::<Option<File>>() == std::mem::size_of::<File>());
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue