| 
 | 
结论5: 
·尽可能地在case语句里使用连续的数字。 
优化提示6: Hi-Tech C里的除法 
 
如果你使用Hi-Tech C,在你程序的任何位置有任何数学除法的运算,就将会使用到bank0里13到23个字节的空间,以及一些EPROM/Flash程序空间。 
尽管变量不在bank0,这一样会发生。  
Occurrence 
Any mathematical division at all in the entire program using a variable of type 'long', even if all variables do not reside in bank0. 
RAM usage 
23 bytes in bank0 
 
ROM/flash usage 
large, it has to include ldiv routines 
Fix/Explanation 
Use combinations of bit shifts ie: x=x*6 is replaced by x1=x;x2=x;x=x1<<2 + x2<<1 
 
Occurrence 
Any mathematical division at all in the entire program using a variable of type 'unsigned int', even if all variables do not reside in bank0. 
RAM usage 
13 bytes in bank0 
ROM/flash usage 
large,it has to include ldiv routines 
Fix/Explanation 
Use combinations of bit shifts 
 
Occurrence 
Any mathematical division involving a divisor that is a power of 2, ie: x=x/64; 
RAM usage 
none 
ROM/flash usage 
low 
Fix/Explanation 
Use combinations of bit shifts 
Occurrence 
Any mathematical division involving a divisor that is not a power of 2, ie: x=x/65; 
RAM usage 
none 
ROM/flash usage 
high 
Fix/Explanation 
make your divisors a power of 2, ie: 2^5=32. |   
 
 
 
 |