Re: [cc65] Optimizing C code

Date view Thread view Subject view

From: MagerValp (MagerValp_at_cling.gu.se)
Date: 2003-09-09 18:28:33


>>>>> "SJ" == Shawn Jefferson <sjefferson_at_sd62.bc.ca> writes:

SJ> if (creg != BAKCOL(bmp->mode)) {              // not background color?
SJ>   //++creg;                                     // creg 0->01, 1->10, 2->11
SJ>   data |= ((creg+1) << plot4cshift[bit]);
SJ> }

Wouldn't it be faster to use a 4-byte table and just use

  data |= creg << plot4cshift[bit];

It'd save you an if and the addition, at the expense of a single byte.
Also, the whole function could be written as a macro with global
variables. Code size would increase a bit if it's called in a lot of
places, but you'd get rid of the function call overhead (20%?).

-- 
                       Wildstar delenda est
    ___          .     .  .         .       . +  .         .      o   
  _|___|_   +   .  +     .     +         .  Per Olofsson, arkadspelare
    o-o    .      .     .   o         +          MagerValp_at_cling.gu.se
     -       +            +    .     http://www.cling.gu.se/~cl3polof/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-09-09 18:33:04 CEST