mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 10:36:26 +08:00
Lookup square distance instead of calculate on the fly
Microptimization that gives a +0.7% speed increase. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -348,6 +348,7 @@ const Value QueenValueEndgame = Value(0x9FE);
|
||||
|
||||
extern const Value PieceValueMidgame[17];
|
||||
extern const Value PieceValueEndgame[17];
|
||||
extern int SquareDistance[64][64];
|
||||
|
||||
inline Value piece_value_midgame(Piece p) {
|
||||
return PieceValueMidgame[p];
|
||||
@@ -440,7 +441,7 @@ inline int rank_distance(Square s1, Square s2) {
|
||||
}
|
||||
|
||||
inline int square_distance(Square s1, Square s2) {
|
||||
return Max(file_distance(s1, s2), rank_distance(s1, s2));
|
||||
return SquareDistance[s1][s2];
|
||||
}
|
||||
|
||||
inline char file_to_char(File f) {
|
||||
|
||||
Reference in New Issue
Block a user