Instead of a switch statement running iterating through branch after branch, is there away to make assembly look up a list in an array for a goto statement? Or is this usually optimized in the compiler?
Such an optimization would help immensely for large switch statements with constant values.
Ex:
switch(test) {
case 1:
// Do something
break;
case 2:
// Do something
break;
}
"Optimized":
action_link[] = {action_1, action_2};
goto action_link[test];
action_1:
// Do Something
action_2:
// Do Something