Салям!

8-Фев-2004 01:28 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

>>         if (drive == 0)
>>           drive = default_drive + 1;
>>         drive--;
BO> If you like to save 1 byte, then I can save another one
BO>   drive--;
BO>   if ((int)drive < 0)
BO>     drive = default_drive;

     Of course, but I prefer not to cross range boundaries and mix signed
and unsigned types - this is why above I prefer to decrease after, not
before comparision.

     Also, this code not equal to original code: it replaces by
default_drive not only value 0, but all vlues with high bit set.

BO> The question is why? Next time the compiler does it all differently than
BO> what we naively expect...

     With `drive' as UBYTE my code (both under BCC and WCC) is same in size
(as original) but less jumps; your code is worser.

     If I replace your code by "if (--drive == (UBYTE)-1)", then code is
better than yours. :) On the other side, under BCC it longer than my, under
WCC it shorter.




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to