]> git.sesse.net Git - stockfish/commit
Mark all compile-time constants as constexpr.
authorRonald de Man <ronalddeman@gmail.com>
Sun, 18 Mar 2018 22:38:58 +0000 (23:38 +0100)
committerStéphane Nicolet <cassio@free.fr>
Sun, 18 Mar 2018 22:48:16 +0000 (23:48 +0100)
commit759b3c79cf94d101163f646b1eb2a9f9c64293ab
tree9bab64042ba6e471359f6d08a971bd3fa9cdcc7d
parent350dff446481b9e274e54dc727141f0dbfec0b23
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.
17 files changed:
src/bitbase.cpp
src/bitboard.h
src/endgame.cpp
src/evaluate.cpp
src/evaluate.h
src/material.cpp
src/movegen.cpp
src/pawns.cpp
src/position.cpp
src/psqt.cpp
src/search.cpp
src/search.h
src/syzygy/tbprobe.cpp
src/timeman.cpp
src/tt.h
src/types.h
src/ucioption.cpp