user32856: From Gigantua, the fastest chess move generator, it says that

The same holds true for the castling squares and most importantly the current moving color becomes a compiletime template and not an if statement. No single if statement should be wasted on non existing moves or which colors move it currently is.
...
We have 6 independent boolean board state flags - and none of these
will ever need a single if during runtime. The cost of having if
(Color == White) or Attack[Color] compiles away into nothingness. We
only need a single switch statement as an entry point

Here is the struct used for the current game state:
class BoardStatus {

public:
    const bool WhiteMove;  const bool HasEPPawn;
    const bool WCastleL; const bool WCastleR;
    const bool BCastleL; const bool BCastleR;

    constexpr BoardStatus(bool white, bool ep, bool wcast_left, 
    bool wcast_right, bool bcast_left, bool bcast_right) :
        WhiteMove(white), HasEPPawn(ep), WCastleL(wcast_left), 
        WCastleR(wcast_right), BCastleL(bcast_left), BCastleR(bcast_right)
    {

    }
}

Because of the constructor, this implies that a new BoardStatus structure will be created for every turn. How can that be efficient?
For example, how does this reduce the number of if statements, because you still have to check the value of the WhiteMove boolean?

user10570: Notice, that the constructor for BoardStatus is constexpr (btw, this question on SO is an interesting extra read on the topic). So, you should think of BoardStatus as a Literal Type, which allows many interesting things to be done with it during the compilation by the compiler (as opposed to runtime calculations), including the elimination of many if statements.
The particular details would depend a lot on how this class is used, but, I would say, that constexpr is the key to the understanding of the quoted explanations.

32856: <p>From Gigantua, the fastest chess move generator, it says that</p>
<blockquote>
<p>The same holds true for the castling squares and most importantly the current moving color becomes a compiletime template and not an if statement. No single if statement should be wasted on non existing moves or which colors move it currently is.</p>
<p>...</p>
<p>We have 6 independent boolean board state flags - and none of these
will ever need a single if during runtime. The cost of having if
(Color == White) or Attack[Color] compiles away into nothingness. We
only need a single switch statement as an entry point</p>
</blockquote>
<p>Here is the struct used for the current game state:</p>
<pre><code>class BoardStatus {

public:
    const bool WhiteMove;  const bool HasEPPawn;
    const bool WCastleL; const bool WCastleR;
    const bool BCastleL; const bool BCastleR;

    constexpr BoardStatus(bool white, bool ep, bool wcast_left, 
    bool wcast_right, bool bcast_left, bool bcast_right) :
        WhiteMove(white), HasEPPawn(ep), WCastleL(wcast_left), 
        WCastleR(wcast_right), BCastleL(bcast_left), BCastleR(bcast_right)
    {

    }
}
</code></pre>
<p>Because of the constructor, this implies that a new <code>BoardStatus</code> structure will be created for every turn. How can that be efficient?</p>
<p>For example, how does this reduce the number of <code>if</code> statements, because you still have to check the value of the <code>WhiteMove</code> boolean?</p>
 10570: <p>Notice, that the constructor for <code>BoardStatus</code> is <a href="https://en.cppreference.com/w/cpp/language/constexpr" rel="noreferrer"><code>constexpr</code></a> (btw, <a href="https://stackoverflow.com/q/31375381/2452869">this question</a> on SO is an interesting extra read on the topic). So, you should think of <code>BoardStatus</code> as a <a href="https://en.cppreference.com/w/cpp/named_req/LiteralType" rel="noreferrer"><strong>Literal Type</strong></a>, which allows many interesting things to be done with it during the compilation by the compiler (as opposed to runtime calculations), including the elimination of many <code>if</code> statements.</p>
<p>The particular details would depend a lot on how this class is used, but, I would say, that <code>constexpr</code> is the key to the understanding of the quoted explanations.</p>
