I have a small doubt
I have following code
bool res= false;
if(cond1)
{
res = true;
}
if(cond2)
{
res = true;
}
Instead of this if I put following code
if(cond1 || cond2)
{
res = true;
}
Which code snippet will be more optimized?
I believe it would be second one as I have avoided an If condition.
Well, I don’t know if it’s appropriate but: It doesn’t matter in this case.
Do not too much of micro-optimizing.
But to answer your question, stick with the readably one.
The fastest solution would be something like this: