I have this code
float Code(float a,float b, int c)
{
float r=0;
if( c==0)
{
r=a*b;
}
else if( c==1)
{
r=a/b;
}
else if( c==2)
{
r=2*a;
}
return r;
}
Lets say i don't have 3 different "if" but a thousand different "if", and "c" as it is in the code just selects one "if"
Has anyone think about a way to make this faster by creating a way of recompiling the code so it deletes all the unnecessary "if" lines in the assembly code
Or is there anything related to this that solves the problem in a different way?