remove unneeded const_assert

This commit is contained in:
Simon Gardling 2025-02-26 23:53:43 -05:00
parent 7ec8a66a4e
commit abee9447ab
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -5,15 +5,12 @@ use super::{
}; };
use const_fn::const_fn; use const_fn::const_fn;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use static_assertions::const_assert;
use std::{cmp::Ordering, fmt}; use std::{cmp::Ordering, fmt};
// PERF! having `Coord` be of type `u8` (instead of usize) increases // PERF! having `Coord` be of type `u8` (instead of usize) increases
// performance by about 1-2% overall // performance by about 1-2% overall
pub type Coord = u8; pub type Coord = u8;
const_assert!(Board::BOARD_SIZE_RAW <= Coord::MAX as usize);
#[derive(PartialEq, Eq, Copy, Clone, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum Winner { pub enum Winner {
Player(Piece), Player(Piece),
@ -89,8 +86,7 @@ impl fmt::Debug for Board {
} }
impl Board { impl Board {
const BOARD_SIZE_RAW: usize = 8; pub const BOARD_SIZE: Coord = 8;
pub const BOARD_SIZE: Coord = Self::BOARD_SIZE_RAW as Coord;
/// Area of the board /// Area of the board
pub const BOARD_AREA: Coord = Self::BOARD_SIZE.pow(2); pub const BOARD_AREA: Coord = Self::BOARD_SIZE.pow(2);