posmap change

This commit is contained in:
Simon Gardling 2025-03-04 11:13:16 -05:00
parent 3eb5b71b7b
commit fa7ad34dcb
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -25,22 +25,10 @@ impl<T: Default> PosMap<T> {
} }
pub fn get(&self, coords: CoordPair) -> &T { pub fn get(&self, coords: CoordPair) -> &T {
debug_assert!( &self.0[coords.0 as usize]
Board::BOARD_AREA + 1 >= coords.0,
"index out of range, was: {:?}",
coords
);
unsafe { self.0.get_unchecked(coords.0 as usize) }
} }
pub fn set(&mut self, coords: CoordPair, value: T) { pub fn set(&mut self, coords: CoordPair, value: T) {
debug_assert!(
Board::BOARD_AREA + 1 >= coords.0,
"index out of range, was: {:?}",
coords
);
self.0[coords.0 as usize] = value; self.0[coords.0 as usize] = value;
} }
} }