From a30ee34ef6de2ed1374ca9e8650c8bb3877b67a5 Mon Sep 17 00:00:00 2001 From: Michael Whiteley Date: Wed, 3 Jun 2026 16:09:32 -0600 Subject: [PATCH] Faster is_noisy. bench 3634130 --- src/types/moves.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/types/moves.rs b/src/types/moves.rs index 5d66d7f5a..f2e8098a5 100644 --- a/src/types/moves.rs +++ b/src/types/moves.rs @@ -65,17 +65,10 @@ impl Move { self.is_present() && !self.is_noisy() } + // Sneaky bit-twidling. If we just look at the last 3 bits (& 7), anything + // greater than Castling is a queen push promotion or a capture. pub const fn is_noisy(self) -> bool { - matches!( - self.kind(), - MoveKind::Capture - | MoveKind::EnPassant - | MoveKind::PromotionQ - | MoveKind::PromotionCaptureN - | MoveKind::PromotionCaptureB - | MoveKind::PromotionCaptureR - | MoveKind::PromotionCaptureQ - ) + (self.kind() as u8 & 7) > MoveKind::Castling as u8 } pub const fn is_special(self) -> bool {