vendredi 19 août 2016

Is there a speed difference in 'if' functionizing for readability in C++?

For example.

bool IsPlayerOutMap()
{
    bool t = (Player.x < 0 || Player.y < 0
        || Player.x > 1000 || Player.y > 1000);
    return t;
}

if(IsPlayerOutMap())
    cnt++;

and

if((Player.x < 0 || Player.y < 0
        || Player.x > 1000 || Player.y > 1000))
    cnt++;

Is there any speed difference in two coding style?

Aucun commentaire:

Enregistrer un commentaire