20. Some C Optimisations Non Optimised code Optimised code Unsigned short int a; a /=8; Unsigned short int a; a>>=3; a*=2; a+=a; for(i=0; i<10; i++) { b = k * c; p[i] = b; } b = k * c; /* constant code moved outside the loop */ for(i=0; i<10; i++) { p[i] = b; }
21.
22. ECU Task: control injection time (3 sub-tasks) T S P compute air flow compute injection time drive actuators air flow injection time air temperature engine temperature engine speed throttle position look-up table PWM signals air pressure