Using case-labels more effectively removes one unnecessary goto:
By rearranging the case-labels in opposite order and using fall-through, we can remove all remaining gotos:Code:case 9: case 15: case 8: VD = 4000; if (c == 9) goto one; else if (c == 15) goto four; break;
--Code:void func2(int x) { int c, d; c = x & 0x0f; d = c & 3; switch(c) { case 15: case 9: case 8: VD = 4000; case 4: if (c & 4) VC = 700; case 3: case 1: if (d == 1) { VA = 1000; } else if (d == 3) { VA = 900; VB = 400; } } }
Mats