I have a piece of code as below:
...
int4 vec;
...
if (condition == 0)
vec.x = 100;
else if (condition == 1)
vec.y ++;
else if (condition == 2)
vec.z ++;
else
vec.w ++;
Is it possible to index to the component dynamically to avoid branching? Ideally, I can do this:
vec.condition ++;
But the above code does not work