C51 version 7.09
a = LEFT ; switch (a) { case LEFT : subproA P1 = 0x01; P1 = 0x01; subproA break; case RIGHT : subproB P1 = 0x01; P1 = 0x01; subproB break; default : somethingjob; }
Have you looked at the generated assembly with and without optimization? The double assignment to P1 that is common to both branches of the case might be optimized into a single bit of code. (Since "subproA" and "subproB" are not syntactically correct C, it's obvious you've abstracted the actual code. So it's hard to tell exactly what's going on. Be sure you haven't omitted any details or inavertently corrected a problem in transforming the original structure to a post.)