From 47bc073d3c3c04c2f4954a308de3f6c6b78ead76 Mon Sep 17 00:00:00 2001 From: mstembera Date: Fri, 17 Jan 2025 11:54:58 -0800 Subject: [PATCH] distance(Square x, Square y) Simplify and optimize by reducing the number of operations. No functional change bench: 1379150 --- src/bitboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitboard.h b/src/bitboard.h index 6f9cca0bdd4..507a04268c3 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -202,7 +202,7 @@ inline int distance(Square x, Square y) { template<> inline int distance(Square x, Square y) { - return std::abs(rank_of(x) - rank_of(y)); + return rank_of(Square(std::abs(x - y))); } template<>