From 8c5fea83599fbb02f0f2c546b165d92301263694 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 19 Feb 2025 20:18:38 -0500 Subject: [PATCH] bitboard: use explicit bit representation --- src/bitboard.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitboard.rs b/src/bitboard.rs index ab2bef1..cf34966 100644 --- a/src/bitboard.rs +++ b/src/bitboard.rs @@ -45,14 +45,14 @@ impl BitBoard { #[cfg(not(feature = "bitvec"))] pub const fn get(&self, row: usize, col: usize) -> bool { - ((self.0 >> Self::get_index(row, col)) & 1) != 0 + ((self.0 >> Self::get_index(row, col)) & 0b1) != 0b0 } #[cfg(not(feature = "bitvec"))] pub const fn set(&mut self, row: usize, col: usize, value: bool) { let index = Self::get_index(row, col); // PERF! branchless setting of bit (~+3% perf bump) - self.0 &= !(1 << index); // clear bit + self.0 &= !(0b1 << index); // clear bit self.0 |= (value as BitBoardInner) << index; // set bit (if needed) }