[cc65] comparing int iterators in loops

From: Johan Kotlinski <kotlinski1gmail.com>
Date: 2012-04-02 09:20:57
Hi, just one thought here. When I make a loop like this:

for (char* ptr = 0xd800; ptr != 0xdbe8; ++ptr) { ... }

...the check for exit condition will be done MSB first. I.e., it would
compare with 0xdb before comparing 0xe8.

Wouldn't it be so much more efficient if it checks LSB first? Roughly
MSB will match one out of four times, while LSB only matches one out
of 256 times. So those second checks could be avoided a lot of times.

Cheers,
Johan
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Apr 2 09:21:30 2012

This archive was generated by hypermail 2.1.8 : 2012-04-02 09:21:34 CEST