Branchless correction history with to_sq_unchecked

Add Move::to_sq_unchecked() that bypasses the is_ok() assertion,
for use in branchless code paths where invalid moves are masked out.

passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 92384 W: 24052 L: 23665 D: 44667
Ptnml(0-2): 265, 10229, 24831, 10588, 279
https://tests.stockfishchess.org/tests/view/6974dfc798dc5fff1dba5b74

closes https://github.com/official-stockfish/Stockfish/pull/6569

No functional change
This commit is contained in:
Maxim Masiutin
2026-02-04 17:44:25 +01:00
committed by Joost VandeVondele
parent 7f85cfbfa2
commit 542c30c292
2 changed files with 12 additions and 7 deletions
+4
View File
@@ -449,6 +449,10 @@ class Move {
return Square(data & 0x3F);
}
// Same as to_sq() but without assertion, for branchless code paths
// where the result is masked/ignored when move is not ok
constexpr Square to_sq_unchecked() const { return Square(data & 0x3F); }
constexpr MoveType type_of() const { return MoveType(data & (3 << 14)); }
constexpr PieceType promotion_type() const { return PieceType(((data >> 12) & 3) + KNIGHT); }