mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Mark all compile-time constants as constexpr.
To more clearly distinguish them from "const" local variables, this patch defines compile-time local constants as constexpr. This is consistent with the definition of PvNode as constexpr in search() and qsearch(). It also makes the code more robust, since the compiler will now check that those constants are indeed compile-time constants. We can go even one step further and define all the evaluation and search compile-time constants as constexpr. In generate_castling() I replaced "K" with "step", since K was incorrectly capitalised (in the Chess960 case). In timeman.cpp I had to make the non-local constants MaxRatio and StealRatio constepxr, since otherwise gcc would complain when calculating TMaxRatio and TStealRatio. (Strangely, I did not have to make Is64Bit constexpr even though it is used in ucioption.cpp in the calculation of constexpr MaxHashMB.) I have renamed PieceCount to pieceCount in material.h, since the values of the array are not compile-time constants. Some compile-time constants in tbprobe.cpp were overlooked. Sides and MaxFile are not compile-time constants, so were renamed to sides and maxFile. Non-functional change.
This commit is contained in:
committed by
Stéphane Nicolet
parent
350dff4464
commit
759b3c79cf
Reference in New Issue
Block a user