mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
Speed-up some arrays reading
This patch removes the empty rows at the beginning and at the end of MobilityBonus[] and Protector[] arrays: • reducing the size of MobilityBonus from 768 bytes to 512 bytes • reducing the size of Protector from 1024 to 512 bytes Also adds some comments and cleaner code for the arrays in pawns.cpp No speed penalty (measured speed-up of 0.4%). No functional change. Closes #1018
This commit is contained in:
@@ -256,12 +256,13 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) {
|
||||
b = theirPawns & file_bb(f);
|
||||
Rank rkThem = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
|
||||
|
||||
safety -= ShelterWeakness[std::min(f, FILE_H - f)][rkUs]
|
||||
int d = std::min(f, FILE_H - f);
|
||||
safety -= ShelterWeakness[d][rkUs]
|
||||
+ StormDanger
|
||||
[f == file_of(ksq) && rkThem == relative_rank(Us, ksq) + 1 ? BlockedByKing :
|
||||
rkUs == RANK_1 ? Unopposed :
|
||||
rkThem == rkUs + 1 ? BlockedByPawn : Unblocked]
|
||||
[std::min(f, FILE_H - f)][rkThem];
|
||||
[d][rkThem];
|
||||
}
|
||||
|
||||
return safety;
|
||||
|
||||
Reference in New Issue
Block a user