??? 05/30/12 08:05 Read: times |
#187580 - Maybe IAR should follow their own advice? Responding to: ???'s previous message |
Andy Neil said:
Getting the Least Out of Your C Compiler
Class #508, Embedded Systems Conference San Francisco 2001 Jakob Engblom, IAR Systems It's a very interesting article ... until you find out that the ARM compiler does not use bit-shifts when dividing a 64-bit integer by a power of 2, but calls the 64-bit division routine (big, slow) in any case. Writing x = x / 1024; is nice for clarity (since it clearly shows that it means an actual division instead of some abstract bit manipulation, but what would you do if x = (x >= 0) ? (x >> 10) : (-((-x) >> 10)); is so much faster and results in smaller code? (provided the case (x == NEGATIVE_MAX) never occurs or is handled separately) |