add const_assert for BitBoard

This commit is contained in:
2025-02-12 10:35:54 -05:00
parent 9a114e2cb9
commit 993af2a191
3 changed files with 15 additions and 0 deletions

7
Cargo.lock generated
View File

@@ -170,6 +170,7 @@ dependencies = [
"num",
"rand",
"rayon",
"static_assertions",
]
[[package]]
@@ -250,6 +251,12 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "2.0.98"

View File

@@ -14,3 +14,4 @@ lazy_static = "1.5.0"
num = "0.4"
rand = "0.9"
rayon = "1.10"
static_assertions = "1.1.0"

View File

@@ -1,4 +1,11 @@
use crate::board::BOARD_SIZE;
use static_assertions::const_assert_eq;
// BitBoard should be big enough to fit all points on the board
const_assert_eq!(
std::mem::size_of::<BitBoard>() * 8,
(BOARD_SIZE * BOARD_SIZE)
);
/// 8x8
/// TODO! look into variable length bit arrays in rust